Managing Git on Openshift
Deprecated
Openshift v2.0 has now reached End of Life and will be replaced by v3.0.
Openshift comes with Git and the tools are pretty easy to use. Here are a few key commands I use whenever I need to rollback a deployment or simply check the health of my app.
Git Status
Check configuration
It's good to check the number of deployments you have available.
rhc app-configure -a [name of app] -n [name of namespace]
Deployments
List available deployments
rhc deployment list -a [name of app] -n [name of namespace]
Show deployment details
rhc deployment show [deployment id] -a [name of app] -n [name of namespace]
Specify number of deployments
rhc app-configure -a [name of app] -n [name of namespace] --keep-deployments 3
Rollback to a previous deployment
rhc deployment activate [deployment id] -a [name of app] -n [name of namespace]
Change branch to deploy
rhc app-configure --deployment-branch -a [name of app] -n [name of namespace]
Branches
Turn Openshift into a remote git-url
git remote add openshift ssh://0000000000@api-appname.rhcloud.com/~/git/api.git/
Update a remote git-url
git remote set-url openshift ssh://0000000000@api-appname.rhcloud.com/~/git/api.git/
Do everything similar to a normal git repo
git add -A
git commit -m 'fixed package.json'
git push
Push to openshift report
git push openshift
Pull from Openshift
git pull openshift master