Bryan O'Malley
“…and if I claim to be a wise man, it surely means that I don't know.”

How To Name Your Git Remotes

Here's a quick tip for how to give your Git remotes a more meaningful name.

Personally, I don't like how every remote defaults to origin.  What does that mean?  Did this code from from Beanstalk?  GitHub?  GitStack?  Who knows?

We can do better.

To assign a meaningful name to the remote when you clone a repository, simply use the -o parameter, followed by the name you wish to use.  For example:

git clone git@account.beanstalkapp.com:/my-awesome-app.git -o beanstalk

or

git clone https://github.com/account/my-awesome-plugin.git -o github

To use these fancy new remotes, you can say…

git push beanstalk master

or

git push github mybranch

Easy as pie.  Mmmmm… pie…

Previous Post Next Post