前言
本文旨在解决和git相关的两个错误情况:
1)Ubuntu下:
git: 'credential-manager' is not a git command. See 'git --help'.
2)使用ssh连接时报错:
ERROR: Permission to xxx/xxx.git denied to <xxx-user>.
fatal: Could not read from remote repository.
问题场景
- Ubuntu 14.04
在使用git push origin master
将本地修改同步到github仓库的时候,出错:
git: 'credential-manager' is not a git command. See 'git --help'.
解决方案
1)运行 git config --list
,部分输出如下:
core.editor=nano
credential.helper=manager
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/xxx.git
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
branch.master.remote=origin
branch.master.merge=refs/heads/master
2)运行git config --global --unset credential.helper
,之后再git push orgin master
即可。
备注:(使用ssh连接时出现的错误)
如果出现错误:ERROR: Permission to xxx/xxx.git denied to <xxx-user>.
依照我的博客https://blog.csdn.net/weixin_39278265/article/details/100118608 运行如下命令即可:
# 开启ssh-agent服务
eval "$(ssh-agent -s)"
# 把刚刚生成的ssh key加入到ssh-agent中
ssh-add ~/.ssh/id_rsa_aaa
参考
[1] git: ‘credential-cache’ is not a git command https://stackoverflow.com/questions/11693074/git-credential-cache-is-not-a-git-command