Code Development Using GitHubΒΆ

GitHub is a great way to store your code in a personal sandbox. It is free for public repositories! This tutorial will teach you how to use the Wicse GitHub repository and use some of the basic git commands.

Once you have created an account at: http://github.com/, install Git.

apt-get install git

Configure your global settings.

git config --global user.name "USERNAME"
git config --globale user.email "EMAIL"

Create and ssh key to upload to the git server.

ssh-keygen

Cat id_rsa.pub and go to: http://github.com/.

Under account settings, add your key to the ssh keys for your account. Now you are free to fork repositories! Forking a repository allows you to modify code and store changes in a local copy of the repository on your home computer. Once you have all your changes in order, they can be moved to your branch on the github server.

Create a directory to hold repositories.

cd repos
git init
git clone git@github.com:USERNAME/new_repository.git

Now you have a new repository! The first thing to do is to create a new branch from your master branch.

cd new_repository
git branch test
git checkout test

Create a link to the main repository so you don’t lose track of changes made by other developers.

git remote add upstream git://github.com/OWNER_CREATOR/new_repository.git

Keep changes up-to-date on your account by fetching the remote upstream and pushing to your origin.

git fetch upstream
git merge origin/master

You will need to commit changes before you can push them.

git add new_file
git commit -a
git push origin master

Watch out! The above command commits ALL changes. This tutorial teaches you how to install git and clone your first repo. Please see the Bible: http://progit.org/.

Previous topic

Make an HD Video on Linux

Next topic

Using SCP and SSH