1

我正在尝试在带有 GIT 和 openSSH 的 Windows 10 上使用 AWS CodeCommit。我可以成功连接 Putty,但我不想使用它。我在 ~/.ssh/id_rsa 中创建了一个密钥并将其上传到 AWS 控制台。因此,如果我尝试在 GitBash 中与 ssh 连接,它就会起作用。

$ ssh git-codecommit.us-east-1.amazonaws.com
You have successfully authenticated over SSH. 
You can use Git to interact with AWS CodeCommit. 
Interactive shells are not supported.
Connection to git-codecommit.us-east-1.amazonaws.com closed by remote host.
Connection to git-codecommit.us-east-1.amazonaws.com closed.

但如果我尝试拉它不起作用。

$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我检查了我的 SSH 密钥 ID,它是正确的。

$ git remote -v
origin  ssh:/***********@git-codecommit.us-east-1.amazonaws.com/v1/repos/myrepo (fetch)
origin  ssh:/***********@git-codecommit.us-east-1.amazonaws.com/v1/repos/myrepo (push)

SSH 连接接缝也适用于我的 SSH 密钥 ID:

$ ssh ***********@git-codecommit.us-east-1.amazonaws.com

我在另一台 Windows PC 上成功配置了一周。

有人有同样的问题吗?任何想法有什么问题?

4

1 回答 1

0

感谢克莱尔 Liguori 的提示。它不适用于 GIT_SSH_COMMAND 但您可以将其用于详细信息 如何使用 SSH 详细模式运行 git push/pull 命令?

所以我发现我的 master 分支的 SSH KEY ID 仍然是错误的。我只运行git remote set-url original ...但我没有更改我的主分支。

于 2015-12-08T10:25:18.293 回答