Git推送原始权限以*拒绝致命:无法从远程存储库读取

时间:2018-06-22 21:38:30

标签: git github

所以我将我的公共ssh密钥添加到了git repo中。我已经将私钥添加到了/c/Users/totty/.ssh/。

我运行ssh -vT git@github.com时说Hi X! You've successfully authenticated, but GitHub does not provide shell access.

运行git push origin会得到Permission to * denied fatal: Could not read from remote repository

这个github有什么问题?我不能从cmd,git扩展名中推送。但是它可以从Windows的github上运行...

删除我的ssh密钥并运行ssh -vT git@github.com后,我得到debug1: No more authentication methods to try.


还有另一件事很奇怪...如果您看到带圆圈的文本,那不是我的用户名或电子邮件。我什至在我的git config中签入,却无处可寻。哪里来的?我的意思是gs11118

enter image description here

2 个答案:

答案 0 :(得分:1)

首先,用户名/电子邮件(您使用git config user.name / user.email设置的用户名/电子邮件与GitHub凭据(用户GitHub帐户名)无关。

第二,确保您的git push实际上使用的是SSH URL:

cd /path/to/my/local/repo
git remote -v

如果您看到一个以https://...开头的URL,则ssh -T git@github.com可以正确识别您的身份无关紧要:Git不会将其用作凭证。它将使用Windows Credentials Manager中存储的内容。

答案 1 :(得分:-1)

您可以推送到不属于您或不属于您的,从他人克隆的仓库。

采用SSH格式的存储库URL(可以由git remote -v显示)是这样的:

origin  git@github.com:username/repo.git(fetch)
origin  git@github.com:username/repo.git(push)

或HTTPS格式:

origin  https://github.com/username/repo.git(fetch)
origin  https://github.com/username/repo.git(push)

在您的存储库中,您可能会发现username不是您的,无论您的组织还是合作者。然后,如果您想推送该消息,则可以进入原始存储库(https://github.com/username/repo),进入fork,将其回购到您的GitHub帐户中(作为问题的github标记),然后使用git remote set-url origin命令来重写本地存储库的远程URL。

此后,您可以将其作为其他用户的分叉推入您拥有的遥控器。 编辑:如果您使用的是HTTPS方式,则可以查看Git Credentials

或者,如果原始存储库是您负责进行开发的位置,则可以请求组织或协作者将您添加为协作者。

EDIT2 :由于@VonC的评论(说话?),您可以查看文件~/.ssh/config,由于您提供的图像,文件可能为C:\Users\totty\.ssh\config ,以查找是否有存储库的指定密钥IdentityFile参考Specify an SSH key for git push for a given domain

相关问题