为什么git remote add不起作用?

问题描述:

为什么在输入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 - 如果必须从根本上改写帖子以提取/识别问题,那么降价是可以证明是合理的。 –

你应该输入:

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://*.com/help/accepted-answer – VonC

+0

好吧..我会看到.. –