Skip to content

Instantly share code, notes, and snippets.

@harrifeng
Created October 11, 2017 03:15
Show Gist options
  • Save harrifeng/457a1ef31cc2443899fcb45c62d664eb to your computer and use it in GitHub Desktop.
Save harrifeng/457a1ef31cc2443899fcb45c62d664eb to your computer and use it in GitHub Desktop.
使用git push提交时,每次都要输入密码,次数多了,感觉挺麻烦. 如果git以ssh协议通讯,免密码可以用ssh公钥设置免登录。如果git时以https方式访问呢,该怎么办?下面方式可以解决这个问题.
* 新建文件并保存密码
touch ~/.git-credentials
vim ~/.git-credentials
添加内容
https://{username}:{passwd}@github.com
* 添加git配置
执行下面命令添加配置
git config --global credential.helper store
* 查看~/.gitconfig文件变化
~/.gitconfig文件多出下面配置项
[credential]
helper = store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment