Difference between revisions of "Github manual for Ubuntu"

From PaparazziUAV
Jump to navigation Jump to search
Line 35: Line 35:
Cloning is a way of downloading a local copy of your project. The following command will clone the code branch, just replace "username" with you GitHub username and project name with the name of project on github: <br><br><code>$ git clone git@github.com:username/projectname.git</code><br><br>
Cloning is a way of downloading a local copy of your project. The following command will clone the code branch, just replace "username" with you GitHub username and project name with the name of project on github: <br><br><code>$ git clone git@github.com:username/projectname.git</code><br><br>
Be aware, do not misspell the command, it won't work. If you are having trouble, read the given error and try to solve him by reading the following page: [https://help.github.com/categories/56/articles GitHub help].
Be aware, do not misspell the command, it won't work. If you are having trouble, read the given error and try to solve him by reading the following page: [https://help.github.com/categories/56/articles GitHub help].
== How to use Github ==
When you have a local copy of your project on your system, you can edit the files (if you have the correct permission). But most unexperienced users forget to update their local copy before editing or upload ("push") the local copy to the GitHub repository when they made a correct change to one or more of their files.

Revision as of 06:32, 26 September 2012

Introduction to Github

Developers often use a repository for developing their software projects. When using a repository, developers can upload and download the code developed for the project. Github is an open source repository site. For more information about repository's and Github, please visit Wiki GitHub. If you do not have a GitHub account and you would like to contribute to a project or develop a project on your own, please register at github.com and follow their "Bootcamp".

 This manual works only for ubuntu users! 

Github and Ubuntu

Github doesn't provide an easy step-by-step guide for using your repository with ubuntu, if you need (or would like) to use ubuntu and github together, we provide a nice and easy guide. This page will help you to Setup github for Ubuntu and use Github. At the end there will be a small summary or so called: "Cheatsheet" with the command's you might need.

Setup Github

When you have a github-account, you may install Github. Before installing Github, you need to set up the ssh keys. This manual will also guide you trough cloning and configurnig with github.

Setup the SSH-key

  1. Open the terminal in Ubuntu.
  2. Type:

    $cd ~/.ssh

    When the terminal displays: ""bash: cd: ./.ssh:No such file or directory" you should generate a public/private rsa ket pair, continue with step 3.
    If the terminal changes to ~/.ssh directory, continue with step 5.
  3. Open a new terminal and type:

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

    After hitting Enter, the terminal will say: 'Generating public/private rsa ket pair. Enter file in which to save the key(/Home/ubuntu/.ssh/id_rsa):' please press only enter and the terminal will ask to enter a passphrase.
  4. Enter a suitable passphrase which is > 4 characters. If this is done, please continue with step 6.
  5. (Follow this step only if your terminal changed to "~/.ssh")
    You already have some SSH-keys, following commands will backup (in folder "key_backup") and remove the keys. Type in your terminal:

    $ mkdir key_backup
    $ cd id_rsa* key backup
    $ rm id_rsa*

  6. Add the SSH-key to github, type in the terminal:

    $ gedit id_rsa.pub

  7. Ubuntu will open a file, copy it's entire content:
    1. Open the github site and login.
    2. Go to "Account Settings" (in the upper right corner from your page).
    3. Click: "SSH Keys"
    4. Click: "Add another public key"
    5. Paste the copied content into the "key field" and press "Add key"

  8. Open the terminal again and type the following command:

    ssh-add

    This is only required if you use ubuntu (which all the readers of this document should, as described in the introduction.)

Your setup for the ssh-key is completed! Now you are ready to install github.

Install Github

Open the terminal and type the following command:

$ sudo apt-get install git-core git-gui git-doc

Your terminal will download some things and install github automaticly. When it's done, your installation is complete! The next step is getting your local copy of the repository (or code-branch), follow the instructions for "Cloning".

Cloning

Cloning is a way of downloading a local copy of your project. The following command will clone the code branch, just replace "username" with you GitHub username and project name with the name of project on github:

$ git clone git@github.com:username/projectname.git

Be aware, do not misspell the command, it won't work. If you are having trouble, read the given error and try to solve him by reading the following page: GitHub help.

How to use Github

When you have a local copy of your project on your system, you can edit the files (if you have the correct permission). But most unexperienced users forget to update their local copy before editing or upload ("push") the local copy to the GitHub repository when they made a correct change to one or more of their files.