SSH 协议
拷贝公钥到gitlab 或者 git 服务器
http 协议
全局配置
- 在家目录下 新建
.git-credentials
文件,并在文件内写入
cat ~/.git-credentials
https://name:passwd@xxxxxxx
https://name:passwd@xxxxxx
name 跟 passwd 替换成 你自己的的用户名跟密码
xxxx 是你要访问的https 网址
- 在命令行下输入
git config --global credential.helper store
参考自:
Git 工具 - 凭证存储