[英]Can I replace my local .git with a remote .git for the same repository?
[英]Why I can't add this remote GitHub repository to my local GIT repository as remote?
我对GIT和GitHub绝对陌生,尝试将我的本地存储库链接到GitHub帐户时遇到以下问题
我做:
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链接。
为什么我收到此错误消息? 什么意味着没有这样的远程“起源” ? 如何解决此问题?
您使用的命令不是添加远程,而是设置现有远程的URL 。 您正在寻找的命令是
git remote add origin https://github.com/AndreaNobili/recipes.git
如果您要更改URL或修正拼写错误,可以使用set-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 master origin github.com/AndreaNobili/recipes.git
git remote add --master origin github.com/AndreaNobili/recipes.git
这仅跟踪主分支
git remote add --track different-oil origin github.com/AndreaNobili/recipes.git
这跟踪不同的油分支
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.