The github experience


I ran into the github site today and find it very popular. Therefore I decided to register a free account and start using it. The github is also one kind of SVN, the Source Verisoning. However, the github is built web-based. Here is the first sentences by wiki page “GitHub is a web-based hosting service for software development projects that use the Git revision control system. GitHub offers both commercial plans and free accounts for open source projects. According to the Git User’s Survey in 2009, GitHub is the most popular Git hosting site.

Similar to SVN, github provides commands like push, pull and checkout.
It allows easy source code versioning for developers. In order to use github, you need the following steps:

1. register an account in github website: https://github.com
2. download git clients: e..g git base, tortoisegit ..optionally, you can install the git extensions which improve the privileges control for github.
In my case, I have installed the git bash shell on my Win7 64. After I launched the shell, I do the following steps.
1. go to the source project directory
2. type in git init to initialise the git Repository
3. type in ssh-keygen -t dsa to generate keys (which will generate a public and private key under the default directory, e.g. .ssh/id_dsa, .ssh/id_dsa_pub
4. type in git add filename to add a source file to local staging area.
5. type in git commint -m “first commit” to commit local changes
6. type in ssh -vT [email protected] to test the connection
7. type in git remote add origin [email protected]:username/repo to set a remote repo
8. type in git push origin master to submit changes to remote server
9. If step 8 has complains and gives the following error:

$ git push origin master
To [email protected]:DoctorLai/PySA.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘[email protected]:DoctorLai/PySA.git’
To prevent you from losing history, non-fast-forward updates were rejec
Merge the remote changes (e.g. ‘git pull’) before pushing again. See t
‘Note about fast-forwards’ section of ‘git push –help’ for details.
You probably need the following to merge the changes from the github server (maybe you already have a repo under the same name in the server)
$ git pull origin master
From github.com:DoctorLai/PySA
* branch master -> FETCH_HEAD
Already up-to-date.
$ git push origin master
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.26 KiB, done.
Total 5 (delta 0), reused 0 (delta 0)
To [email protected]:DoctorLai/PySA.git
aede9d9..ea19427 master -> master

There are some other commands which are also useful:
git status -s
git remote -v

I have created the first repo in github https://github.com/DoctorLai/PySA which is a Simulated Annealling Class wrapped in Python. I will submit more code later (an example class to demostrate the usage)

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
605 words
Last Post: Codeforces: A. Next Round
Next Post: The 'any' keyword in Python

The Permanent URL is: The github experience

Leave a Reply