Mohannd's answer is perfect, but I would like to sum up the complete solution, in case some else needs it:
To use your github repo as an Openshift repo, there is no perfect solution now, because, Openshfit uses git hooks to trigger the deployment or redeployment based on your commits. However, the smartest way would be to use 2 repos (the openshift's one and your github's one) to push simultaneously the code to.
To do this:
Add a remote named "all" and add 2 push urls to it.
git remote add all ssh://[email protected]/~/git/yourapp.git
git remote set-url openshift-git-repo --push --add ssh://[email protected]/~/git/yourapp.git
git remote set-url github-repo --push --add [email protected]:youruser/yourapp.git
Then set the remote named 'all' as the default push remote:
git push -u all
To commit and push your code, proceed as usual: It will push on the 2 remotes and deploy on OpenShift
git add .
git commit -m "my commit"
git push
And watch the result:
[master 3fc96b2] my commit
1 file changed, 2 deletions(-)
MyLaptop:myapp User$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 291 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To [email protected]:User/myapp.git
a036a44..3fc96b2 master -> master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 291 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Stopping PHP 5.4 cartridge (Apache+mod_php)
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Building git ref 'master', commit 3fc96b2
remote: Preparing build for deployment
remote: Deployment id is 9037d37a
remote: Activating deployment
remote: Starting PHP 5.4 cartridge (Apache+mod_php)
remote: Application directory "/" selected as DocumentRoot
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://[email protected]/~/git/myapp.git/
a036a44..3fc96b2 master -> master
MyLaptop:myapp User$
Hope this helps