注意,这里是HTTP方式免密,不是SSH方式免密,html
SSH方式请看另外一篇博客:http://www.javashuo.com/article/p-kkuxmbzq-ch.htmllinux
说明:%HOME%,通常为C:\users\Administrator,也能够是你本身建立的系统用户名目录,反正都在C:\users\中git
一.windows下:github
须要建立一个.git-credentials文件,因为在Window中不容许直接建立以"."开头的文件,因此须要借助git bash进行,步骤以下:vim
1.打开git bash客户端,进入%HOME%目录(即C:\users\本身的电脑用户名,通常为C:\users\Administrator)windows
2.用touch建立文件 .git-credentials。bash
3.touch建立文件后用vim打开并编辑此文件,命令以下:spa
打开并编辑:vim .git-credentials(i-进入编辑模式)
编辑内容:https://{username}:{password}@github.com(登陆帐号,邮箱和密码)
保存编辑内容:按<ESC>键退出编辑模式,:wq <回车>保存并退出
4.以后在执行.net
git config --global credential.helper store
打开%HOME%目录下的.gitconfig文件,会发现多了以下内容:code
[credential] helper = store
以上配置好后,关闭git bash从新打开,以后pull一个项目,首次仍是要输入用户名及密码,以后pull成功后,再之后pull和push都不须要在输入用户名及密码了,此后打开新建的.git-credentials文件发如今https://{username}:{password}@github.com之上多了一条相似的文本。
本地Windows下还能够经过添加环境变量来配置,
参考网址:http://www.cnblogs.com/ballwql/p/3462104.html
二.Linux或者Mac下方法:
基本步骤和上面相似,就是linux下面能够直接建立.git-credential文件,命令以下:
建立文件,进入文件,输入内容:
cd ~ touch .git-credentials vim .git-credentials https://{username}:{password}@github.com
在终端下输入:
git config --global credential.helper store
打开~/.gitconfig文件,会发现多了一项:
[credential] helper = store