User Tools

Site Tools


linux:git

GIT with github.com



Official Homepage
The first thing you need is a github.com Account.

After that look if you already have a public key file:

locate *.pub | grep ~/.ssh

If you dont have a pair of keys just create one:

ssh-keygen -t rsa -C "your_email@youremail.com"

Then you have to add your public key in your github.com Account settings.

First Settings

Test the validation of your key by typing:

ssh git@github.com

You should be able to successfully connect.

After that set your username and email:

git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@youremail.com"

Set up your github.com token:

git config --global github.user username
git config --global github.token 0123456789yourf0123456789token

You will find your token in your Account Settings.

Creating a repositoriy

Repositorities are created on your github Homepage.

Adding Files to your Repositority

mkdir Test_Project_2
cd Test_Project_2
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:SchleimKeim/Test_Project_2.git
git push -u origin master

Adding commits

cd /yourproject 
git commit -a -m 'second commit'
git push

Forking a Project

If you fork a Project you get a copy of the master and you can bild your own fork.

working on the master

git clone git@github.com:username/Spoon-Knife.git
# only do the next line if you want to get the upstream from the original project:
git remote add upstream git://github.com/octocat/Spoon-Knife.git
git fetch upstream

Push commits

git push origin master

Using git on Windows

Its practically the same. You just have to install the officiall windows git application
and then you can user the git-bash to do exactly the same as in linux.

linux/git.txt · Last modified: 2011/09/30 20:52 by skull@darktemple.ch