首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么不能将这个远程GitHub存储库作为远程添加到本地GIT存储库中?

为什么不能将这个远程GitHub存储库作为远程添加到本地GIT存储库中?
EN

Stack Overflow用户
提问于 2016-08-18 09:12:14
回答 2查看 2.1K关注 0票数 1

我在GIT和GitHub中是全新的,我在尝试将本地存储库链接到GitHub帐户时遇到了以下问题

我知道:

代码语言:javascript
复制
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/recipes (master)
$ git remote set-url origin https://github.com/AndreaNobili/recipes.git
fatal: No such remote 'origin'

其中https://github.com/AndreaNobili/recipes.git是GitHub为这个存储库提供的https链接。

为什么我会得到这个错误信息?什么意思没有如此遥远的“起源”?我怎样才能解决这个问题?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-08-18 09:13:43

您使用的命令不是添加,而是设置现有远程的URL。您要查找的命令是

代码语言:javascript
复制
git remote add origin https://github.com/AndreaNobili/recipes.git

如果您想要更改URL或修复错误,可以使用set-url

代码语言:javascript
复制
# Note the typo in the URL:
git remote add origin https://gmail.com/AndreaNobili/recipes.git
# This command fixes the typo:
git remote set-url origin https://github.com/AndreaNobili/recipes.git
票数 8
EN

Stack Overflow用户

发布于 2016-08-18 09:30:31

作为对此的扩展,您可以使用

代码语言:javascript
复制
git remote add --track master origin github.com/AndreaNobili/recipes.git
git remote add --master origin github.com/AndreaNobili/recipes.git

这只跟踪主分支。

代码语言:javascript
复制
git remote add --track different-oil origin github.com/AndreaNobili/recipes.git

这个跟踪不同的石油分支。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39014211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档