If you are or want to be an open-source developer, you must try GitHub. It is a new hosted Git repository service that’s being called a “social network” for programmers. It is basically a distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Setup SSH key
Generate SSH Key
If you have created your account at GitHub and now you want to work with it from your terminal.
Before you start installing Github, you should set up ssh keys:
cd .ssh
ssh-keygen -t rsa -C "root@haozhexie.com"
If your key does not have the default filename, you’ll have to pass the path to ssh-add
.
ssh-add ~/.ssh/my_other_key
# Enter passphrase for /home/you/.ssh/my_other_key: [tappity tap tap]
# Identity added: /home/you/.ssh/my_other_key (/home/you/.ssh/my_other_key)
And you will get the following output:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hzxie/.ssh/id_rsa): github
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in github.
Your public key has been saved in github.pub.
The key fingerprint is:
a5:93:9a:e1:b6:23:f7:ac:48:2e:5a:dc:70:18:dd:26 root@haozhexie.com
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . . |
| . E o . |
| o o + |
| o . . S |
| . + . + . |
| o o = |
| ..o.ooo |
|.. .ooo+o |
+-----------------+
Add your SSH Key to GitHub
Look up your SSH key in id_rsa.pub file:
cat github.pub
Copy the SSH public key to the clipboard, and Open https://github.com/settings/ssh
Click “Add SSH Key”, and paste your SSH key.
Test connection to GitHub
ssh -vT git@github.com
If you got an error: Agent admitted failure to sign, =simply running ssh-add
to load your keys into the SSH agent will fix this issue.
ssh-add
# Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
# Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
Or, you will get a welcome message:
Hi zjhzxhz! You've successfully authenticated, but GitHub does not provide shell access.
Install Git
sudo apt-get install git
Working with git
Cloning
git clone git@github.com:username/projectname.git
To configure git
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
To do a script/config, make, perform some changes to the code, …
git add new_or_existing_file.c
git commit
git push origin master
Occasionally you will want to sync up your fork to the main project branch and pull down any official changes by doing git pull upstream master which is the equivalent of manually doing:
git fetch upstream
git merge upstream/master
You can get more information about Git at: http://rogerdudler.github.io/git-guide
The Disqus comment system is loading ...
If the message does not appear, please check your Disqus configuration.