为什么 git remote add 不起作用?

Has*_*ana 4 github

为什么我在键入时看到错误消息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
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 6

你应该输入:

git remote add origin https://github.com/hashanmalawana/Loginsystem.git 
Run Code Online (Sandbox Code Playgroud)

不是

git remote add origin remote repository https://github.com/hashanmalawana/Loginsystem.git
                      ^^^^^^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)

这样,您添加一个名为 的远程origin,引用远程存储库https://github.com/hashanmalawana/Loginsystem.git

你不会看到使用信息

usage: git remote add [<options>] <name> <url>
Run Code Online (Sandbox Code Playgroud)

我知道“使用命令行将现有项目添加到 GitHub ”的第 8 步可能会令人困惑:

git remote add origin remote repository URL
Run Code Online (Sandbox Code Playgroud)

但是最后三个参数实际上只有一个。它应该是:

git remote add origin <remote repository URL>
Run Code Online (Sandbox Code Playgroud)

最好参考实际的手册页git remote

git remote add <name> <url>
Run Code Online (Sandbox Code Playgroud)