17

I created a new repository called DirectorySocket, and from my project directory called DirectorySocket I did the following:

$ git init
$ git add .
$ git remote add origin git@github.com:neilghosh/DirectorySocket.git
$ git commit -m "Initial version"
$ git push origin master

And I got the following error:

ERROR: Permission to neilghosh/DirectorySocket.git denied to neilghosh/googly. fatal: The remote end hung up unexpectedly

Why is it trying to push to another repository of mine on GitHub? This happens also after I deleted the .git folder and started over.

Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
Neil
  • 5,919
  • 15
  • 58
  • 85
  • Another case in the event Google brings you here. I was trying https connection with github and it was failing every time between 50 and 95% complete upload. I took the moment to `ssh-keygen` and followed @manojlds link (there's another link for ssh keys at the bottom) and it worked. Slowly, but it worked. – Krista K Feb 13 '13 at 21:56
  • Another answer for Googlers: trying to pull from a path with an unescaped space in it (e.g. "/Users/rog/James James/project") will cause this. – rogueleaderr Apr 23 '13 at 21:23

3 Answers3

17

Since it is your repository, check if the keys and token are setup properly as per the instructions provided by GitHub.

http://help.github.com/win-set-up-git/

As a first step, see if

 ssh -T git@github.com

works.

manojlds
  • 290,304
  • 63
  • 469
  • 417
4

There are a couple of leads here - it is most likely an authorization issue. Have you uploaded your public key to GitHub?

What is your network situation? I get this response behind my restrictive corporate firewall - the answer there is to use the smart HTTP support now supported by GitHub.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nate
  • 12,499
  • 5
  • 45
  • 60
  • Thanks, The problem was with authentication "ssh -T git@github.com" was not even working. However the message was misleading that it was trying to push the code to a different repository of mine. Solved the problem by adding another public key in the github. [link](http://help.github.com/win-set-up-git/) – Neil Jul 24 '11 at 18:31
1

Direct link to GitHub explanation here:

https://help.github.com/articles/generating-ssh-keys

Flavio Wuensche
  • 9,460
  • 1
  • 57
  • 54