Blog



Faster git deployment

23 Jun 2014 | 1 minute read

Tags: git , vcs , heroku , PaaS

This trick let’s you push to two repositories with one command. It is great for projects that need really rapid development and aren’t yet populated by many users. Before using make sure that deploying with every git push will not result with catastrophic consequences.

I assume Github for version control and Heroku for hosting, but it works with any remote Git repository and Cloud Platform offering deployment by git.

First, repo needs to be created:

$ git init
$ git remote add origin git@github.com:meeDamian/meeDamian.github.io.git

or cloned:

$ git clone git@github.com:meeDamian/meeDamian.github.io.git

Second, add heroku remote:

$ git remote set-url origin --push --add git@heroku.com:meedamian-com.git

Previous command replaces Github’s push remote. To re-add it:

$ git remote set-url origin --push --add git@github.com:meeDamian/meeDamian.github.io.git

If everything went well you should get something like this:

$ git remote -v
origin  git@github.com:meeDamian/meeDamian.github.io.git (fetch)
origin  git@heroku.com:meedamian-com.git (push)
origin  git@github.com:meeDamian/meeDamian.github.io.git (push)

Done :)

To push&deploy, after some commits, just:

$ git push

Let me know if you think this trick is awesome, terrible or you know how to improve it even further!

Just a random Octocat image

comments powered by Disqus