为什么我不能将这个远程GitHub仓库添加到我的本地GIT仓库作为远程?
问题描述:
我在Git和GitHub上是绝对新的,我有以下问题想我的本地库链接到GitHub的帐户为什么我不能将这个远程GitHub仓库添加到我的本地GIT仓库作为远程?
我做的:
[email protected] 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是所提供的HTTPS链接GitHub这个仓库。
为什么我会得到这个错误信息?什么意思没有这样的远程'起源'?我该如何解决这个问题?
答
您所使用的命令不是加入远程但设置的现有的远程的URL。你正在寻找的命令是
git remote add origin https://github.com/AndreaNobili/recipes.git
set-url
可以使用,如果你想改变一个URL或修复一个错字:
# 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
答
作为一种推广这个,你就可以使用
此跟踪主分支只有
git remote add --track different-oil origin github.com/AndreaNobili/recipes.git
这跟踪不同油分支