git push origin master不起作用 [英] git push origin master does not work
问题描述
尽管我可以在本地提交我的更改,但我无法推送给原始主人。
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
我得到
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
这有什么问题?
推荐答案
2-way to do this
1st: -
git remote set-url <name> <newurl>
例子: -
git remote set-url origin git@github.com:username/test.git
第二种: -
您需要做的是更改'原点'设置。 git / config在您的项目根目录中,可能看起来像这样:
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/*
...
或者您的'remote'实际上是本地的:
or if your 'remote' is actually local:
...
[remote "origin"]
url = /path/to/repos/on/this/machine
fetch = +refs/heads/*:refs/remotes/origin/*
...
您需要做的就是使用您最喜欢的编辑器编辑该文件,并将url =设置更改为您的新位置。假设新版本库已正确设置,并且您的网址正确无误,那么您将很高兴地推送和移出您的新远程位置。
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.
这篇关于git push origin master不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!