简体   繁体   中英

AWS CodeCommit - Can't clone repository (SSH)

I'm unable to clone aws codecommit repository. I'm able to browse the repository via console, with appropriate credentials.

The output of GIT_SSH_COMMAND="ssh -v" git clone ssh://git-codecommit.ap-south-1.amazonaws.com/v1/repo/myrepo my-repo as below:

Cloning into 'my-repo'...
OpenSSH_6.6.1, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /home/ec2-user/.ssh/config
debug1: /home/ec2-user/.ssh/config line 2: Applying options for git-codecommit.*.amazonaws.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to git-codecommit.ap-south-1.amazonaws.com [52.95.88.???] port 22.
debug1: Connection established.
debug1: identity file /home/ec2-user/.ssh/ogdev.ppk type 1
debug1: identity file /home/ec2-user/.ssh/ogdev.ppk-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version AWSCodeCommit VGh1LCAxMiBBcHIgMjAxOCAxNTozNTo0NCArMDAwMNf1UNJXOZTiyhCrnVuHnM7KIV3JCAKV4HC0cPMkB5lMrF
debug1: no match: AWSCodeCommit VGh1LCAxMiBBcHIgMjAxOCAxNTozNTo0NCArMDAwMNf1UNJXOZTiyhCrnVuHnM7KIV3JCAKV4HC0cPMkB5lMrFJGcDVDK05keFNhSitRdllFb1RadzZtS1p3Tlk1SWJ6ZVBieE9oTFQ2M1E9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: kex: diffie-hellman-group-exchange-sha256 need=20 dh_need=20
debug1: kex: diffie-hellman-group-exchange-sha256 need=20 dh_need=20
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<7680<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA da:41:1e:07:3b:9e:76:a0:c5:1e:64:88:03:69:86:21
debug1: Host 'git-codecommit.ap-south-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/ec2-user/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ec2-user/.ssh/ogdev.ppk
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to git-codecommit.ap-south-1.amazonaws.com ([52.95.88.149]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: git-upload-pack '/v1/repo/myrepo'
You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit.
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Connection to git-codecommit.ap-south-1.amazonaws.com closed by remote host.
Transferred: sent 3608, received 2048 bytes, in 0.0 seconds
Bytes per second: sent 889760.6, received 505052.6
debug1: Exit status -1
fatal: Could not read from remote repository.

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

All privileges except Create/ Delete Branch; Create/Delete Repository; Update DefaultBranch are assigned to the policy that's attached to the user's role.

I have gone through all existing questions in this area.

Could anyone help resolving this issue?

TIA

Is the command you provided "GIT_SSH_COMMAND="ssh -v" git clone https://git-codecommit.ap-south-1.amazonaws.com/v1/repo/myrepo my-repo " the right one? it seems you are using http protocol. Can you confirm the endpoint is right? It seems you are trying to clone from ap-south-1, is it the same region as you are checking in the console?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM