Keeping track of all of the information about a remote repository reference can become tedious and difficult: you have to remember the full URL for the repository; you must type and retype remote references and refspecs on the command line each time you want to fetch updates; you have to reconstruct the branch mappings; and so on. Repeating the information is also likely to be quite error-prone.
You might also wonder how Git remembers the URL for the remote
from the initial clone for use in subsequent fetch or push operations
Git provides three mechanisms for setting up and maintaining information about remotes: the git remote command, the git config command, and editing the .git/config file directly. All three mechanisms ultimately result in configuration information being recorded in the .git/config file.
The git remote command is a more specialized interface, specific to remotes, that manipulates the configuration file data. It has several subcommands with fairly intuitive names. There is no “help” option, but you can circumvent that to display a message with subcommand names via the “unknown subcommand trick”:
git remote xyzzyerror: Unknown subcommand: xyzzy usage: git remote or: git remote add <name> <url> or: git remote rm <name> or: git remote show <name> or: git remote prune <name> or: git remote update [group] -v, --verbose be verbose