Today I would like to show you how to use github. I'm not an expert (I'm rather n00b TBH ) but I learned some things and might help you with simple git commands.
1. Github? What's that?
In short it's the web-based hosting service for software development projects that use the Git revision control system. In English - the place where you store your sources.
2. Creating an account.
- 2.0 Download the required libs
sudo apt-get install git
- 2.1 Create an account on github.com website
- 2.2 In terminal type:
git config --global user.name "Your Name Here" git config --global user.email "email@example.com"
2.3 Create your unique SSH public key
ssh-keygen -t rsa -C "firstname.lastname@example.org" # Creates a new ssh key using the provided email # Generating public/private rsa key pair. # Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
# Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
# Your identification has been saved in /c/Users/you/.ssh/id_rsa. # Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub. # The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db email@example.com
... and check if everything works
ssh -T firstname.lastname@example.orgCode:
The authenticity of host 'github.com (18.104.22.168)' can't be established. # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. # Are you sure you want to continue connecting (yes/no)?
# Hi username! You've successfully authenticated, but GitHub does not # provide shell access.
And we are ready to do some serious things!
3. Forking a repo
As an example I'll use https://github.com/CyanogenMod/andro..._apps_Settings
Open this link in the browser and click fork.
- 3.1 Clone the source from your fork.
I use my account as an example.
git clone git://github.com/eagleeyetom/android_packages_apps_Settings.git -b gingerbread
- 3.2 Do some changes!
For example add files, remove them etc.
- 3.3 Commit the changes
OPTIONAL I created new branch at my project and named it "xda"
To do this go to the cloned folder and type:
git branch xda git checkout xda
As you can see I removed few files and added one.
Now it's time to tell the git what we want to do.
4. Pushing the changes
Add all modified files:
git add .
git add -u
git add name_of_file git rm name_of_file
Now it's time to commit:
git commit -m 'my first commit'
git push email@example.com:eagleeyetom/android_packages_apps_Settings.git xda
Woo hoo! Now let's check the website.
That's the most basic basics
In the next posts I will show you some more advanced commands like merge, cherry-pick, removing branches etc.
All my friends from GingerDX IRC channel
If you find it useful hit thanks button. You can also consider a small donation