What exactly do these mean?
1. git remote add origin email@example.com:snowcrash/my_app.git
git works locally but to connect to other repositories (or repos) it uses the term `remote` which are repos on other servers that you can `push` your changes to (so other people can see them) or `pull` updates (from other people).
This command creates a new `remote` called `origin` (by convention but could be something else) which is located at the github URL (again, it could be another server) called `firstname.lastname@example.org:snowcrash/my_app.git`.
2. git push origin master
OK, so you’ve defined a new `remote` called `origin`. This command simply pushes your `master` branch to this server.
Note: in future, you just do:
to push your master branch to origin. This is because:
– if no remote is specified, the remote of the current branch is used. If that’s not set up then `origin` is used
– if there’s no `refspec` specified (i.e. `master`, `some-branch`) then git pushes every local branch that has the same name as the branch on th remote.
To avoid accidentally pushing other branches it’s a good habit to use the full version, i.e.
`git push origin master`
despite it being a bit longer.
Seeing these settings:
1. All of this information is stored in your local git repo in this file:
e.g. details of your new remote will be on the line following:
2. Also, you can use the following to list your remotes:
and to see the URL that git has stored for the short names:
`git remote -v`
To find out more information about a remote:
`git fetch origin`
This fetches all the data about that remote project that you don’t have.
For more information about this remote:
`git remote show origin`
This lists the URL for the remote repo as well as the tracking branch information.
Finally, you’ll want to be able to pull from the remote. Just use:
The git book is here:
which contains lots of useful examples including how to remove and rename remotes.
There’s also a great post here: