Github“致命:远程原点已经存在” [英] Github "fatal: remote origin already exists"

查看:849
本文介绍了Github“致命:远程原点已经存在”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图遵循 Michael Hartl的Rails教程,但我已经运行一个错误。

我在Github上注册并发布了一个新的SSH密钥并创建了一个新的存储库。但是,当我进入终端的下一行时,出现以下错误:

  Parkers-MacBook-Pro:.ssh ppreyer $ git remote add origin git@github.com:ppreyer / first_app.git 
致命的:远程原点已经存在。

只是想知道是否有人遇到这个问题?



   $ git remote set-url origin git@github.com:ppreyer / first_app.git 

长版本:



如错误消息所示,已经有一个配置了相同名称的远程服务器。因此,您可以使用不同的名称添加新的远程设备,或者在不需要的情况下更新现有的远程设备:



要添加新的远程设备,例如 github 而不是 origin (它显然已经存在于您的系统中),请执行以下操作:

  $ git remote add github git@github.com:ppreyer / first_app.git 

请记住,教程中的任何地方都可以看到origin,您应该用github替换它。例如 $ git push origin master 现在应该是 $ git push github master



但是,如果您想查看已存在的 origin ,您可以执行 $ git remote -v 。如果你认为这是由于某种错误,你可以像这样更新它:

  $ git remote set-url origin git @ github.com:ppreyer/first_app.git 


I am trying to follow along Michael Hartl's Rails tutorial but I've run across an error.

I signed up on Github and issued a new SSH key and made a new repository. But when I enter the next line into the terminal I get the following error:

Parkers-MacBook-Pro:.ssh ppreyer$ git remote add origin git@github.com:ppreyer/first_app.git
fatal: remote origin already exists.

Just wondered if anybody else has run across this problem?

解决方案

TL;DR you should just update the existing remote:

$ git remote set-url origin git@github.com:ppreyer/first_app.git

Long version:

As the error message indicates, there is already a remote configured with the same name. So you can either add the new remote with a different name or update the existing one if you don't need it:

To add a new remote, called for example github instead of origin (which obviously already exists in your system), do the following:

$ git remote add github git@github.com:ppreyer/first_app.git

Remember though, everywhere in the tutorial you see "origin" you should replace it with "github". For example $ git push origin master should now be $ git push github master.

However, if you want to see what that origin which already exists is, you can do a $ git remote -v. If you think this is there by some error, you can update it like so:

$ git remote set-url origin git@github.com:ppreyer/first_app.git

这篇关于Github“致命:远程原点已经存在”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆