Francesco Marchioni
Francesco Marchioni

Reputation: 4338

Unable to clone with git+ssh


I'd need to clone a repository through git+ssh (git+ssh://git.host.repository.com). It fails as it uses my OS username instead of my organization user's name.

Cloning into 'project.name'...
[email protected]'s password:

There "francesco" is my OS account name, which obviously fails to login. Within ~/.ssh/config I have added:

IdentityFile ~/.ssh/id_rsa.pub

But it didn't work. Also I've tried to update the key (which contains my corporate account):

touch ~/.ssh/id_rsa.pub

It still attempts to use the OS username to login and not the username contained in the public key. Any help?

Upvotes: 1

Views: 77

Answers (1)

Mukul Gupta
Mukul Gupta

Reputation: 2425

You should edit for ssh config confile similar to below. User can enforce the user to use for ssh.

Host git.host.repository.com
  HostName git.host.repository.com
  User git
  IdentityFile ~/.ssh/github/id_rsa

Upvotes: 2

Related Questions