标签:username 这一 matching 问题 efault 提交代码 http password ice
我曾经切换过一次github账号, 似乎还更改过一次github账号的密码, 然后呢?
然后就是每次向github提交代码时都要输入用户名密码(猜测是由于上述原因导致),
每次都是啊, 这也忒麻烦了, 于是就想办法解决这个问题, 经过一番查找, 终于找到一个解决办法, 分享之, 与君共勉 !!
==============
解决方案:
.git-credentials
C:/Users/username
/Users/username
/home/username
https:{username}:{password}@github.com
git config --global credential.helper store
~/.gitconfig
文件末尾添加如下配置:
[credential]
helper = store
经过上述三步配置之后, 你push代码到github时, 便无需再输入用户名密码了~~
=================
续集......
后来发现, 不用上面三步这么麻烦, 简化流程如下:
在命令行输入命令:git config --global credential.helper store
? 这一步会在用户目录下的.gitconfig文件最后添加:
[credential]
helper = store
现在push你的代码 (git push
), 这时会让你输入用户名密码, 这一步输入的用户名密码会被记住, 下次再push代码时就不用输入用户名密码啦!
?这一步会在用户目录下生成文件.git-credential
记录用户名密码的信息.
? git config --global
命令实际上在操作用户目录下的.gitconfig
文件, 我们cat一下此文件(cat .gitconfig
), 其内容如下:
[user]
name = alice
email = alice@aol.com
[push]
default = simple
[credential]
helper = store
git config --global user.email "alice@aol.com"
操作的就是上面的emailgit config --global push.default matching
操作的就是上面的push段中的default字段git config --global credential.helper store
操作的就是上面最后一行的值
作者:元亨利贞o
链接:http://www.jianshu.com/p/81ae6e77ff47
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
标签:username 这一 matching 问题 efault 提交代码 http password ice
原文地址:http://www.cnblogs.com/insomniazz/p/7801965.html