git 致命:远程源已经存在 - GitHub
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20564462/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fatal: remote origin already exists - GitHub
提问by nazar_art
I'm newly at Git. And I tried to create my first repo and push project.
我刚加入 Git。我尝试创建我的第一个 repo 和 push 项目。
I'm creating step by step to the Create A Repo.
我正在逐步创建 Create A Repo。
But after I tried to push my project to the empty repo I caught next:
但是在我尝试将我的项目推送到空仓库之后,我发现了下一个:
fatal: remote origin already exists
致命:远程源已经存在
Here is my steps:
这是我的步骤:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:nazar-art/NewYearGift.git
git push -u origin master
And exactly here I caught this fatal
.
正是在这里,我抓住了这一点fatal
。
I tried git remote -v
to see content of remote repo. Here is result:
我试图git remote -v
查看远程仓库的内容。这是结果:
origin https://github.com/nazar-art/NewYearGift.git (fetch)
origin https://github.com/nazar-art/NewYearGift.git (push)
I couldn't figure out what I'm doing wrong and how to fix this issue?
我不知道我做错了什么以及如何解决这个问题?
- How to solve this trouble?
- 如何解决这个烦恼?
回答by Faruk Sahin
Seems like remote origin is already there somehow and you want to change its uri to another value. You can't add origin since its already there but you can update it. Instead of git remote add
command, you can run:
似乎远程源已经以某种方式存在,您想将其 uri 更改为另一个值。您无法添加原点,因为它已经存在,但您可以更新它。代替git remote add
命令,您可以运行:
git remote set-url origin [email protected]:nazar-art/NewYearGift.git