0

I'm having a similar problem to this: Permission denied (publickey). fatal: The remote end hung up unexpectedly while pushing back to git repository

But I suspect it might be more complicated because I am running vagrant on a mac (mountain lion) and I am having this "Permission Denied" issue that I wasn't having in Snow Leopard.

I set up git on my mac (mountain lion) with ssh key, it works.

I set up vagrant (lucid32 box) and set up a new ssh key (once I ssh'ed into vagrant):

cd ~/.ssh
ssh-keygen -t rsa -C "myemail@mail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/vagrant/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): [just hit enter]
Enter same passphrase again: [just hit enter]

Then I added the ssh key to my github repo (note: was having problems with pbcopy/xclip so I just used vi and copy-pasted)

vagrant@lucid32:~$ cd /vagrant/
vagrant@lucid32:/vagrant$ git push -u origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

So, now I have two ssh keys in my github repo:

- My Mac key (works, can commit to my non-vagrant repo from my mac)
- My vagrant key (does not work, cannot ssh into vagrant and commit my repo from my vagrant box)
Community
  • 1
  • 1
redconservatory
  • 21,438
  • 40
  • 120
  • 189

2 Answers2

1

Are you trying to push to a github repo?

If so, you're going to need to add the SSH key of the vagrant VM to your account on Github under account settings.

Keep in mind, a Vagrant VM is essentially a "different" machine than your local machine, so it will have a different SSH key.

See this github article on working with SSH keys

Ethan Hayon
  • 346
  • 1
  • 9
  • Sorry I meant to mention that I did add the **new, vagrant** key to my github repo (I went back and edit my question)...which is why I can't figure out what's wrong! – redconservatory Aug 10 '12 at 15:24
0

Mine started working, I followed this advice: Unable to Git-push master to Github

And added a config file to my ~/.ssh folder. Not it works but I'm not sure if why that helps?

Community
  • 1
  • 1
redconservatory
  • 21,438
  • 40
  • 120
  • 189