Tuesday, October 19, 2010

How to download, install, configure and upload content to GitHub

Introduction

This post describes how to download, install, configure and upload content to GitHub.

What is GitHub?

Git is a distributed version control system. GitHub provides a way for sharing content in Git with other people

How do I get GitHub?

Sign up for a free account here: https://github.com/signup/free

Once you have your account, create a new repository: http://github.com/repositories/new

After setting up your account you will need to Download and Install Git on your PC.

msysgit is the Windows version, available here: http://code.google.com/p/msysgit/downloads/list?can=3

At the time of writing the latest version is: 1.7.3.1

Accept the defaults when installing

So how do I set it up?

Once Git is installed, run the application Git > Git GUI > Create New Repository > [enter a name] > Create

This will create a new folder in your Documents and Settings folder with the name of your repository

Copy or create your new project in the folder.

In Explorer, right click on the new top level folder > Git add all files now

Run the command prompt: Git > Git Bash

git config --global user.name "Your Name"
git config --global user.email "Your email address"


Next set up a SSH public key on your PC that links you to the repository:

http://help.github.com/msysgit-key-setup/

Change to the location of the new repository:
cd MvcDB4O

git init
ssh-keygen –t rsc –C "Your email address"

You will be prompted for a location for the key, hit enter for the default
Enter a passphrase

You will be told the location of the ssh public key

Create an SSH public key from the website: https://github.com/account > add another public key

Give it a title and the key you created in Git Bash

So how do I push my files to GitHub?

In Git Bash
Change to the directory of the repository

git remote add origin git@github.com:your-git-username/repository-name.git

git push origin master (you will be asked for your passphrase)


(ensure the .ssh folder exists in the repository you are uploading)

Switch to GitHub to view the uploaded files

Conclusion

Hopefully you have found this information useful - good luck with your Git friends.