1

I'm trying to use AWS CodeCommit on Windows 10 with GIT and openSSH. I can successfully connect with Putty but I don't want to use it. I created a key in ~/.ssh/id_rsa and uploaded it to AWS Console. So if I try to connect with ssh in GitBash than it works.

$ 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.

But if I try to pull it doesn't work.

$ 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.

I checked my SSH Key ID, it's correct.

$ 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 connection seams also to work with my SSH Key ID:

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

I successfully configured it on another Windows PC for a week.

Does anybody have the same issue? Any Idea what can be wrong?

CyberAleks
  • 1,545
  • 1
  • 14
  • 17
  • At least from the output in the git pull is provided and that your ssh keys are valid, it seems like for that particular git repository you dont have access – Raghav Nov 21 '15 at 09:52
  • I always get Permission denied even my ssh keys are invalid. – CyberAleks Nov 21 '15 at 11:00
  • The other Windows PC you have configured it on is using another IAM user. One that has the correct CodeCommit policy attached. Try comparing the two IAM users. (and post a hint here, I have the exact same problem :-) – klang Nov 24 '15 at 12:53
  • It is the same user. It just a office PC and a home PC. – CyberAleks Nov 24 '15 at 12:55
  • If you're using git 2.3.0+, you can use the following command to get verbose output for the SSH connection. Look for "Offering RSA public key" to see what keys the SSH client is using: GIT_SSH_COMMAND="ssh -v" git pull – Clare Liguori Nov 30 '15 at 18:07
  • It doesn't help. I don't see anything else. – CyberAleks Dec 08 '15 at 09:14

1 Answers1

0

Thanks Clare Liguori for a tip. It didn't work with GIT_SSH_COMMAND but you can use this for verbose How can I run git push/pull commands with SSH verbose mode?

So I found out that my SSH KEY ID for master branch was still wrong. I only run git remote set-url original ... but i didn't change my master branch.

Community
  • 1
  • 1
CyberAleks
  • 1,545
  • 1
  • 14
  • 17