git push origin master does not work

git, github

Solution

2-way to do this 1st:-

 git remote set-url <name> <newurl>

example:-

git remote set-url origin git@github.com:username/test.git

2nd:-

What you need to do is change your 'origin' setting.you edit .git/config in your project root, which may look something like this:

...
[remote "origin"]
url = git://user@dev.foo.com/git/repos/path
fetch = +refs/heads/*:refs/remotes/origin/*
...

or if your 'remote' is actually local:

...
[remote "origin"]
url = /path/to/repos/on/this/machine
fetch = +refs/heads/*:refs/remotes/origin/*
...

All you need to do is edit that file with your favorite editor and change the url = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll be happily pushing and pulling to and from your new remote location.

Problem

Although, I could commit my change locally, I can not push to origin master I run ``` $ git remote add origin git@github.com:username/test.git ``` I get ``` fatal: remote origin already exists. ``` I run ``` $ git push -u origin master ``` I get ``` ERROR: Repository not found. fatal: The remote end hung up unexpectedly ``` What's wrong with this?

Original source