簡體   English   中英

為什么我不能將此遠程GitHub存儲庫添加為本地GIT存儲庫?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM