Version Control using Git and Github

github

Version Control with Git and Github on Your Personal Computer

It is easy to have version control using Git and Github on your personal computer. To work with Git on your personal computers, download and install git from the official website at git-scm.org. The website will automatically present you with the appropriate Windows, OS X, or Linux installation packages.

Once you have installed Git, open git-bash in Windows, or Terminal in OS X, and run the ssh-keygen command to generate an ssh key for connecting to Github. Then log in to Github and go to your account settings and add the key by pasting the content of your id_rsa.pub file into the key field.

In Windows, the id_rsa.pub file is usually located in a .ssh folder in your Documents (or My Documents) folder. In OS X, the id_rsa.pub file is usually located in ~/.ssh like with Unix/linux systems.

Once you’ve added the key, you can run the command “ssh [email protected]” to see if it worked. If it works, you’ll be greeted with your Github username.

To pull the repo, run the command “git clone [email protected]:directoryname/newfolder”. A “newfolder” folder will be created in the current location where you executed the command.

You can now make changes, then commit the changes by running the command “git commit -a -m ‘message’ ” where message is a description of of the changes you made.

Run “git push” to push the changes.

The changes will be reflected on site within seconds.

A standard work session consists of the following actions (in order):

Do: git pull
Edit files…
Do: git commit -a -m “changed such-and-such”
Do: git push

Alright, so try it out!

Leave a Reply

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