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 [email protected]/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
CodePudding user response:
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.
CodePudding user response:
Because your SSH private key file not having the default name [id_rsa]
if you rename it to id_rsa
it works.
Another solution if you don't like to rename it
Make file in .ssh Folder from terminal call config
touch config
Put path for SSH file on it and save it
Host bitbucket.org
IdentityFile ~/.ssh/id_mykey_ed25519
User git
and try to clone again it works without any problem
git clone ssh://bitbucket.org/myaccount/myrepo.git