7

I kept having problem with github these days, i created a new repository on github, then from local machine I tried to push my code to github:

git remote add origin git@github.com:tmi/logger.git
fatal: remote origin already exists

git push origin master
ssh: github.com:uhdyi: no address associated with name
fatal: the remote end hung up unexpectedly

ssh git -v
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Fed 2007
ssh: git: no address associated with name

ssh git@github.com
Enter passphrase for key '/c/Documents and Settings/tmi/.ssh/id_rsa':
Error: HI, tmi! you've successfullly authenticated, but GitHub doesn not provide shell access
connection to github.com closed

git push origin master
ssh: github.com:uhdyi: no address associated with name
fatal: the remote end hung up unexpectedly

what's wrong here? Thanks!

mipadi
  • 398,885
  • 90
  • 523
  • 479
ohana
  • 131
  • 2
  • 2
  • 3

3 Answers3

11

Look:

fatal: remote origin already exists

You already have a remote named origin, and it's still using the old, invalid URL. Open up .git/config and change the URL for the origin remote, or use the set-url subcommand for git remote:

$ git remote set-url origin git@github.com:tmi/logger.git
mipadi
  • 398,885
  • 90
  • 523
  • 479
  • `ssh: git: no address associated with name` and `fatal: remote origin already exists?` are two separate problems. What's the solution to the former one? – Piotr Dobrogost Nov 16 '11 at 21:37
  • For me, `ssh: git: no address associated with name` happened because my internet connection was busted in a VM – bendytree Apr 04 '13 at 20:07
5

I had the no address associated with name problem and after searching it was a DNS problem. The DNS simply was wrong on the machine and it could not find the IP address of the remote git repository.

Ido Ran
  • 10,584
  • 17
  • 80
  • 143
  • 2
    Yes, I had this problem and I cleared my DNS cache. On Windows this is done from command prompt using ipconfig /flushdns I was then able to run my git commands with no issues. So, lesson learned is that git bash still uses the local OS DNS resolvers. – Finster Mar 13 '14 at 15:50
4

How would the error

ssh git -v
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Fed 2007
ssh: git: no address associated with name

be related to

fatal: remote origin already exists?

Also couldn't that problem be solved by

git remote add someothername git@github.com:tmi/logger.git
sanon
  • 6,403
  • 2
  • 21
  • 26
  • `ssh: git: no address associated with name` and `fatal: remote origin already exists?` are indeed two separate problems and unfortunately mipadi answers only to the latter one. – Piotr Dobrogost Nov 16 '11 at 21:35