Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Git clone with shorthand SSH URL

Trying to clone with full SSH URL, e.g., git clone ssh://bitbucket.org/myaccount/myrepo.git fails with permission denied (publickey), but using shorthand SSH URL, e.g., git clone git@bitbucket.org/myaccount/myrepo.git works just fine. Furthermore, even doing something like the following fails:

ssh-agent bash -c 'ssh-add ~/.ssh/id_mykey_ed25519; git clone ssh://bitbucket.org/myaccount/myrepo.git'

EDIT:
I already have an entry of the following form in SSH config:

Host bitbucket.org
IdentityFile ~/.ssh/id_mykey_ed25519
IdentitiesOnly yes

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Add User git:

Host bitbucket.org
    IdentityFile ~/.ssh/id_mykey_ed25519
    IdentitiesOnly yes
    User git

Now you can do

git clone ssh://bitbucket.org/myaccount/myrepo.git

without setting user explicitly.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading