Modern Enterprise Code

How to add a GitHub repo to your OpenShift repo

openshiftAs you might know if you’re reading this post, OpenShift automatically initializes a new git repository on your local environment when you create a new gear. I think that’s pretty cool how it integrates your build with your source control through all its various git hooks. And I think that’s pretty similar to Heroku.

However, let’s say you don’t really want to use OpenShift as your only remote repo. Easy to solve: add another remote repo for, say,

First, create a new repo on GitHub:


Next, cd into the source directory where OpenShift initialized a git repo for you (probably through the rhc create-app CLI command) and add the remote repository with a command that looks like this:

Let me explain. After the “add” command, you are going to name your remote server. I chose “github” because that makes sense to me. The next parameter that looks like git@github is the location of your repo on GitHub — it’s the same path you would use to clone a local repo from GitHub. Copy and paste it.

When you’re ready to push, you can use this command:

This tells git to push your local master to the github remote, which is your repo on

I hope this helps. I completely understand that there are a million ways to push and pull repos and branches in Git — that’s its true power. I just hope this gets you going quickly. Local results will vary!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.