Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

六、git操作常见报错及解决办法FAQ #6

Open
zhangzhikai397 opened this issue Jan 12, 2020 · 1 comment
Open

六、git操作常见报错及解决办法FAQ #6

zhangzhikai397 opened this issue Jan 12, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@zhangzhikai397
Copy link
Owner

zhangzhikai397 commented Jan 12, 2020

1、git push 报permission denied

Step01 我们在本地仓库能够正常的从远端仓库pull文件到本地仓库,但是我们从本地push问价难道远程仓库的时候报 ! [remote rejected] master -> master (permission denied) 详细错误如下图所示:

image

可以搜索相关的git凭证缓存博客文章了解;
【参考博文】https://blog.csdn.net/qq_41311259/article/details/81255315
【参考博文】https://www.cnblogs.com/volnet/p/git-credentials.html

Step02 这是应该git配置文件里面已经缓存了上一个仓库的账户和密码,这样他会从目录 ·C:\Users\86136下搜索 配置文件 .gitconfig,一般这个账户密码缓存在 .git-credentials中;因此我们需要清空以前的缓存凭证。那么我们先使用命令 git config --list命令查看配置里面是否配置了credential.helper这一项,于是我在我的系统里面查到了:
image

Step03 那么我们需要将credential.helper配置项删除掉,我们需要删除系统级(system)、全局级(--global)、用户级(--local)三个清空下的配置项;使用如下命令:
git config --system(--global/--local) --unset credential.helper

Step04 删除掉credential.helper配置项之后,我们再使用 git push命令的时候就找不到缓存的账户和密码了,这个时候系统就会提示我们输入github的账户和密码,输入完毕之后就可以正常的push文件到远程仓库了。

image

@zhangzhikai397
Copy link
Owner Author

zhangzhikai397 commented Jan 12, 2020

2、git删除配置遇到multiple values错误

如果使用git config --local --unset credential.helper命令对credential.help命令进行删除时报warning: credential.helper has multiple values错误,会导致无法删除配置项,入下图所示。
image

此时我们应该先将这些需要删除的项合并成一个,使用命令git config --local --replace-all credential.helper "store" 将所有的credential.helper的值替换为store`,如下图所示:
image

然后我们在执行git config --local --unset credential.helper命令时,就会发现已经删除了credential.helper配置项

image

`

@zhangzhikai397 zhangzhikai397 added the documentation Improvements or additions to documentation label Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant