2012-04-09 112 views
4

虽然,我可能会在本地提交我的变化,我不能推到原点主混帐推起源主不起作用

我跑

$ git remote add origin [email protected]:username/test.git 

我得到

fatal: remote origin already exists. 

我跑

$ git push -u origin master 

我得到

ERROR: Repository not found. 
fatal: The remote end hung up unexpectedly 

这是怎么回事?

+1

您可以使用'git remote -v'查看当前定义的遥控器的值。 – Amber 2012-04-09 02:09:28

回答

1

看起来你的配置文件中有一个origin的错误条目。

编辑您的存储库的.git/config文件以更改它;格式是不言自明的,但如果遇到问题,请发布其内容。

+0

这很奇怪。我从乞讨中做了同样的事情,然后这一次它工作..无论如何谢谢! – 2012-04-09 03:46:53

5

2路做到这一点
1: -

git remote set-url <name> <newurl> 

例如: -

git remote set-url origin [email protected]:username/test.git 

第二: -

你需要做的是改变你的“出身” setting.you编辑的.git /配置项目中的根,它可能是这个样子:

... 
[remote "origin"] 
url = git://[email protected]/git/repos/path 
fetch = +refs/heads/*:refs/remotes/origin/* 
... 

,或者如果你的“远程”实际上是地方:

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

您需要做的就是使用您最喜欢的编辑器编辑该文件,并将url =设置更改为您的新位置。假设新的存储库已正确设置,并且您的URL正确,那么您将会愉快地推送并从新的远程位置进出。