0

I have multiple git repositories I need to connect to. For each one, the person in charge emailed me a public/private keypair to use to access the repository. I stored them in my .ssh directory along with my personal key:

$ ls ~/.ssh
id_rsa     id_dsa_site1    id_rsa_site2    id_rsa.pub
id_dsa_site1.pub    id_rsa_site2.pub

Then, I read some articles online that recommended I set up a config file, which I did:

$ cat ~/.ssh/config
Host site1.sub.domain.com
    User gitosis
    IdentityFile ~/.ssh/id_dsa_site1

Host git.site2.sub.domain.com
    User gitosis
    IdentityFile ~/.ssh/id_rsa_site2

However, when I try to clone the repos, I'm still being prompted for a password:

$ git clone gitosis@site1.sub.domain.com:myrepo.git
Initialized empty Git repository in /home/robert/myrepo/.git/
gitosis@site1.sub.domain.com's password: 

It looks like the key isn't associating properly. No google/so search I can think of is solving the problem. Any ideas?

Robert Martin
  • 16,759
  • 15
  • 61
  • 87

2 Answers2

2

The config file belongs in your .ssh directory, too

Right now the file is not being used so you are prompted for a password

klaustopher
  • 6,702
  • 1
  • 22
  • 25
0

Solution Found

(for future people with this problem)

Logging out and back in solved the problem for me.

Robert Martin
  • 16,759
  • 15
  • 61
  • 87