2017-08-13 645 views
-6

爲什麼在輸入git remote add時看到錯誤信息?爲什麼git remote add不起作用?

$ git remote add origin remote repository https://github.com/hashanmalawana/Loginsystem.git 
usage: git remote add [<options>] <name> <url> 

    -f, --fetch   fetch the remote branches 
    --tags    import all tags and associated objects when fetching 
          or do not fetch any tag at all (--no-tags) 
    -t, --track <branch> branch(es) to track 
    -m, --master <branch> 
          master branch 
    --mirror[=<push|fetch>] 
          set up remote as a mirror to push to or fetch from 
+0

有一個問題在這裏? –

+0

實際上有*明確的*一個問題,一個有效的問題,如果需要時間來看,而不是盲目地downvoting或關閉,並且需要努力編輯和調查:官方GitHub幫助頁面之一是混淆,這個問題是澄清這個問題的好機會。這似乎更好,結束問題 – VonC

+0

@VonC - 如果必須從根本上改寫帖子以提取/識別問題,那麼降價是可以證明是合理的。 –

回答

1

你應該輸入:

git remote add origin https://github.com/hashanmalawana/Loginsystem.git 

git remote add origin remote repository https://github.com/hashanmalawana/Loginsystem.git 
         ^^^^^^^^^^^^^^^^^^ 

這樣,你添加遠程命名origin,引用遠程回購https://github.com/hashanmalawana/Loginsystem.git

,你不會請參閱使用信息

usage: git remote add [<options>] <name> <url> 

我理解的 「Adding an existing project to GitHub using the command line」 第8步可能會造成混淆:

git remote add origin remote repository URL 

但最後三個參數其實是唯一的一個。它應該閱讀:

git remote add origin <remote repository URL> 

這是更好地指actual man page for git remote

git remote add <name> <url> 
+0

好的,謝謝你.. –

+0

@HashanMalawana當然,不要忘了閱讀https://stackoverflow.com/help/accepted-answer – VonC

+0

好吧..我會看到.. –