且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git:git pull每次都要求输入用户名和密码

更新时间:2022-09-03 20:05:29

git pull 每次都要求输入用户名和密码

全局配置

git config --global credential.helper store

或者局部配置

git config credential.helper store

查看git配置

git config --list

如果有多个账号,可能会出现403报错

这时看下文件,如果有多个账号,可以尝试删除

rm ~/.git-credentials

解决办法

修改项目目录下的配置文件

$ vim ./.git/config

[remote "origin"]
url = https://<username>:<password>@e.coding.net/project/demo.git
$ more ~/.git-credentials
https://<username>:<password>@e.coding.net

参考:

git 为不同的项目设置不同的用户名和邮箱

git ,报403错误,完美解决方案