Setting Github Repository

Overview

This article will walkthrough setting up a Github repository and using a Ubuntu Desktop environment to perform push and pull requests.

Pre-Requisits

It is assumed you have an account on Github already at http://github.com. It is also assumed you are familiar with a distributed source control system.

Create Repository

    New github repository

  1. Go to https://github.com/new and complete online form to setup a new repository.

Clone Repository

Perform a clone of the repository to the local computer:

  1. On Ubuntu Desktop open a terminal window.
  2. Go to the parent folder to where the project folder will be created.
  3. Github clone URL

  4. Run git clone [url] where [url] should be replaced with the address of the repository on the repository webpage.
  5. A new folder will be created with all the project files inside.
  6. Reset the github repository URL git remote set-url origin git@github.com:username/repo.git where username should be replaced with the github username and repo.git should be replaced with the repository .git file. This url should be similar to the clone URL but during the clone it does not at the git@github.com part.

Commit Changes Locally

After adding files or making changes to existing files perform a commit to the local copy of the repository:

  1. git commit
  2. Enter comments to the commit.

Push Changes

Before being able to push changes to the repository on github, an SSH key is required:

  1. ssh-keygen -t rsa -b 2048 rsa could be changed to dsa encryption protocol and 2048 is the length of the key (higher the better)
  2. open ~/.ssh/id_rsa.pub for rsa key or ~/.ssh/id_dsa.pub for a dsa key and copy the newly generated public part of the key
  3. On github web page go to Account Settings > SSH Keys or
  4. Click on the Add SSH Key
  5. Give the key a name
  6. Paste the contents of the id_rsa.pub into the box provided.
  7. Press the Add Key button to save the key.

Push the changes to the central repository so that everyone can get them:

  1. git push

Summary

GitHub makes it very easy to use Git and uses SSH for security.

Git push requires username and password

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in SCM and tagged , , , , , . Bookmark the permalink.

Leave a Reply