当我git clone
从github回购邮件时-一切正常。仓库已下载,但是当我尝试将更改推送到仓库时,git说:
ERROR: Permission to my_user_name/repo_name.git denied to other_user_name.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
所以我尝试推送到我的仓库,但是github认为我是其他用户。这是怎么发生的?(那个家伙属于我的团队-我们一起从事一些项目)。以及如何解决这个问题?
当我这样做时ssh -T -ai ~/.ssh/id_rsa [email protected]
-它表示other_user_name
已授权,而不是我!但是,当我这样做时ssh -T -ai ~/.ssh/id_rsa [email protected]
-它会告诉我我的名字。那怎么可能?
看来我已经找到问题的根源。
为了将一个应用程序部署到生产环境,我们使用ansible
并使用单独的ssh-key连接到服务器。事实证明,该部署密钥是我们团队中一名成员的密钥。因此,在将该密钥保留在我的系统中之后,在推送到github时会导致问题,导致github选择了找到的第一个密钥。
为了删除所有键,我只需要运行ssh-add -D
。之后,登录github
并bitbucket
使用我自己的默认ssh-key完成。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句