北冰洋以北 发表于 2025-3-28 04:28:27

git pull和push总是提示输入Git账号密码的办理方法

最近的项目在执行 git pull/push 的时候,总是提示要输入账号和密码。输入精确之后,下次执行 git pull/push 的时候还必要重新输入账号密码。
这应该是我不知道啥时候使用了错误的账号和密码,办理方法很简单:先 cd 到根目次,执行以下命令:
   git config --global credential.helper store
然后 cd 到项目目次,执行 git pull 命令,会提示输入账号密码。
输完这一次以后就不再必要
在多个项目,不同的git服务器,不同用户名时,对每个项目设置各自的local 设置。
## local
git config --local credential.helper store

git config --local user.email "email"
git confgi --local user.name "name" git设置级别

   # 全局,保存在~/.gitconfig(windows),/etc/gitconfig(linux)
git config --global 设置内容
# 当地,保存在当地库/.git/config
git config --local 设置内容
 
检察GIT设置

   # 查看所有git设置
git config -l

# 查看git存储方式
git config -l | find "credential"
credential.helper=store

# 查看不同级别的credential.helper
# 全局
D:\test> git config --global credential.helper
manager
# 本地
D:\test> git config --local credential.helper
store

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: git pull和push总是提示输入Git账号密码的办理方法