参考: https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E5%87%AD%E8%AF%81%E5%AD%98%E5%82%A8
介绍
在使用宇宙无敌最强版本管理 git
时, 如果使用 https
连接, 通常要求你输入 username
& password
.
那么如何可以不用每次都输入 username
& password
呢?
- 采用
SSH
连接方式
前提当然你得有权限将自己主机id_rsa.pub
加入到git
账户的SSH Keys
中 - 采用
HTTPS
连接方式
只要你有仓库访问权限即可, 使用本文即将介绍的credential
来配置一下即可
配置 credential helper
存储配置到本地 ~/.my-credentials
文件
git config --global credential.helper store --file ~/.my-credentials
下一次 git pull
/git push
时, 输入的 username
和 password
将会被保存到 ~/.my-credentials
中;
以后再次 git pull
/git push
将不再需要 username
和 password
.