Git Push to Remote Repository

October 15th, 2011 by Regaz

This Tutorial is based on my actual Experience of Git and SSH at Hostgator.
Pushing mean Transfer a Copy of your Changes to a Remote Repository.
Here below are resumed the steps involved:

Adding a Remote Repository
General form of Add Remote:
git add remote repoName repoURL

The Protocol over that the transfer is make are Git and SSH.
Here below is the Command to add the Default Git Repository over SSH.

git remote add origin ssh://yourUserName@yourDomain:portNumber/path/To/yourRepo

Example:
git remote add origin ssh://user@server.hostgator.com:2222/home/user/www/yourRepo

Adding Changes and Commit
To take a Snapshot of your Valid Work you need to Add Changes and Commit on Git.
To Add Changes:
git add nameFile1 nameFile2 nameFile3 ...

Or if you just want to Add all Working Changes:

git add .

To Commit or to Take a Snapshot of your Valid State:

git commit -m "Description of Changes"

In the Case you want an All-in-One Command to Add all your Changes and Commit perform:

git -a -m "Description of Changes"
Pushing to the Remote Repository
General Form of Push Command:
git push repoName branchName

The default Repository Name is the Origin.
The default Branch Name is the Master.
So for pushing to Origin on the Master Branch:

git push origin master

Or Simply:

git push

To Read something more about Git Branching look Here.

Check this…


Bloogger Blogger, Google Blogger, Google Google

Apache Virtual Host

Tags: , ,