FORUMS
Remove All Ads from XDA
Thread Deleted Email Thread
Prev Previous Post   Next Post Next
Hi.
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
    Code:
    sudo apt-get install git
  • 2.1 Create an account on github.com website
  • 2.2 In terminal type:
    Code:
    git config --global user.name "Your Name Here"
    git config --global user.email "[email protected]"
    NOTE: use the e-mail used in the website account creation
    2.3 Create your unique SSH public key
    Code:
    ssh-keygen -t rsa -C "[email protected]"
    # 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]
    Now you need to enter a passphrase.
    Code:
    # Enter passphrase (empty for no passphrase): [Type a passphrase]
    # Enter same passphrase again: [Type passphrase again]
    Which should give you something like this:
    Code:
    # 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 protected]
    Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com


    ... and check if everything works

    Code:
    ssh -T [email protected]
    Code:
    The authenticity of host 'github.com (207.97.227.239)' 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)?
    Duh?! Sure I want! Yes! Yes! Yessss!

    Code:
    # 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.

    Code:
    git clone git://github.com/eagleeyetom/android_packages_apps_Settings.git -b gingerbread
    -b gingerbread let us to choose what branch are we going to download


  • 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:
    Code:
    git branch xda
    git checkout xda
    Now it's time to see what's going on:
    Magic command
    Code:
    git status


    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:
    Code:
    git add .
    Add all removed files
    Code:
    git add -u
    You can also add/rm one file
    Code:
    git add name_of_file
    git rm name_of_file
    After git status we should get something like this:



    Now it's time to commit:

    Code:
    git commit -m 'my first commit'
    And finally to push:

    Code:
    git push
    If you'll get some errors use the following:

    Code:
    git push [email protected]:eagleeyetom/android_packages_apps_Settings.git xda
    I used the name of my github and the name of the branch in the end.



    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.


Credits:
Google
Github Team
All my friends from GingerDX IRC channel

If you find it useful hit thanks button. You can also consider a small donation
The Following 362 Users Say Thank You to eagleeyetom For This Useful Post: [ View ] Gift eagleeyetom Ad-Free
Subscribe to Thread

Tags
git, github, guide, pull request

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes