Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why git remote add is not working?

Tags:

github

Why do I see an error message when typing 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
like image 954
Hashan Malawana Avatar asked Aug 13 '17 17:08

Hashan Malawana


1 Answers

You should type:

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

not

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

That way, you add a remote named origin, referencing the remote repo https://github.com/hashanmalawana/Loginsystem.git

And you won't see the usage message

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

I understand that the step 8 of "Adding an existing project to GitHub using the command line" can be confusing:

git remote add origin remote repository URL

But the last three parameters are actually only one. It should read:

git remote add origin <remote repository URL>

It is better to refer to the actual man page for git remote

git remote add <name> <url>
like image 109
VonC Avatar answered Sep 23 '22 01:09

VonC