使用 Git 进行 git pull
等操作时每次都需要输入账号和密码,这可能是因为 Git 客户端没有正确配置凭据存储或者你的Git
仓库使用的是 HTTPS
协议链接。
解决方案:
-
首要的必然是使用
SSH
协议,更安全
没配置,有需要见 引用链接 -
编辑配置文件
在项目中的.git
文件夹中找到config
文件,在末尾加上一句:[credential] helper = store
-
使用凭证管理器
1)Git for Windows,配置如下:
git config --global credential.helper wincred
2)macOS,配置如下:
git config --global credential.helper osxkeychain
3)Linux,配置如下:
git config --global credential.helper libsecret 或(因为没试过所以不知道哪个有效) git config --global credential.helper store
-
配置
.netrc
文件
没用过,不写了,有需要见 引用链接
原文链接:https://blog.youkuaiyun.com/dnpao/article/details/144204751