git remote add remote_name remote_location
remote_name is usually origin in most examples. If you have more than one remote then you will use a different name. For github I usually use "github" instead of origin and have command aliases built around this to make life easier (ie- git config --global alias.pg=push github master
). There is also a github ruby gem that provides shortcuts for using github.
remote_location is the url or scp path to the remote repo. Repos using ssh, including private github repos use scp paths in the form of user@host:path/to/repo.git
. Github abstracts this out to git@github:username/repo.git
. Read only repos use http and are simple urls to the git repo http://host/path/to/repo.git
.