This article is a short overview of how to use Git for Linux system administrators particularly when using OpenShift.
When you create your OpenShift application, OpenShift will present you with the Git location you must use for uploading and downloading the web-application code. Updates to the web application code in this location will be automatically applied and made live for your OpenShift site. This update happens as part of the Git “push” process.
I’ve created an OpenShift account, created a PHP application with OpenShift and i’ve called it simply “php”. On completion of crating my php application within OpenShift, i was presented the following Git repository location:
On your local computer with Git installed, issue the following commands. Note that during the OpenShift setup, i (and you will be too) was asked to provide my SSH public key. This allows me to push and pull code to the Git repository.
Get the code from the OpenShift Git repository:
cd ~ mkdir git cd git git clone ssh://firstname.lastname@example.org/~/git/php.git/
Having run the above command, your local computer will have a copy of whatever the OpenShift instance has in terms of the web application. Let’s make some changes and upload them:
Make changes and upload them to your OpenShift Git repository:
cd php echo "<?php phpinfo(); ?>" > index.php git commit -m "example 4" index.php git push
You can now visit your OpenShift website and see your new changes.