Create GitHub Repository

Post date: Oct 09, 2010 1:44:7 PM

Installing Git allows you to clone other's repositories, and create a repository on your own system. You can use GitHub to create an online repository, accessible from anywhere. A paid account may create public or private repositories, limited to those you give access to. A free account may only create public repositories, accessible by everyone.

Sign up

Go to http://github.com/plans and select the type of plan you're interested in.

Enter account information:

    • Username (your_id is an obvious choice)

    • Email (not shared, so feel free to use your main email address)

    • Password (Very important, don't re-use a password from an insecure site like a message board)

Click "Create Account".

Add account information

Click "Tell us about yourself".

    • Public Profile (All entires are visible to everyone, so think carefully. This is optional.)

    • Email addresses (private)

      • Add your dedicated gmail account here, in addition to your main email account.

    • SSH Public Keys (private?)

      • Upload public keys from any user accounts that will modify Git repositories.

      • Click "Add another public key"

        • Title: Description of public key, i.e. your_id@hostname

        • Key: Open your PUBLIC keyfile (id_rsa.pub), copy the contents, and paste here

      • Click "Add key". It's added.

      • Copy/paste GitHub's RSA fingerprint. You'll need to reference it when you connect to github the first time.

    • Job Profile (public)

      • You can advertise yourself here, there's even an "Available for hire" checkbox.

      • Click "Update Job Profile".

You can associate a picture with your account(s) by signing up at gravatar.com. One gravatar account can control separate icons for each email account.

Create a local repository

Before you upload your project to GitHub, you'll need a local git repository for it. Example:

    • Start MinGW Shell

  • cd project_name

  • git init

  • git add *

  • git commit -m "Start project_name repository"

Remember, these files and commit comments will be publicly readable after pushing to public repository.

Create a public repository

Log in to GitHub, and click the "Dashboard" link at the top. On the right is "Your Repositories".

    • Click "New Repository".

    • Enter the project description:

      • Project Name

      • Description

      • Homepage (Use that dedicated Google site!)

    • Click "Create Repository".

Git gives instructions on how to push your local repository to your new public repository:

  • git remote add origin git@github.com:your_id/project_name.git

  • git push origin master

    • If this is your first time connecting, you should verify the RSA key fingerprint, then enter "yes".

    • If you haven't run sshagent.sh, enter your SSH key passphrase.

Return to the GitHub webpage, and click Continue to go to your public repository.

Committing new versions of your project

Every time you run " git commit -m 'Comment' ", you are creating a version of your project. In between commits, you can run "git add filename" to add/update a file, and "git rm filename" to remove it from the project. The removed file will remain in earlier "commits", and not shown in the latest version.

Here's an example, creating a README file, adding it, committing changes to repository, then pushing it to GitHub:

  • vi README

project_name: Reads input, processes it, then outputs data in desired format.

This project is dedicated to Mom and Dad. Also, my cat Snickerdoodle. You can see the project page at http://www.github.com/your_id/project_name . This is a test, this is only a test.

This project is released under the CYOL v2. All rights reserved. Check us out on facebook and twitter!

  • git add README

  • git commit -m "Created a README file so Git would stop bothering me"

  • git push origin master

Renaming remote repository

If you want to support multiple remote repositories, you should give them different names. Rename "origin" to "github":

  • git remote rename origin github

Now, when you want to push to github after commiting, you would use this command:

  • git push github master

What now?

If you want to cover the basics: http://gitref.org/. You should, I don't know Git very well right now!

GitHub has a nice guide on adding/removing remove repositories: http://help.github.com/remotes/

To remove sensitive data you accidentally commited: http://help.github.com/removing-sensitive-data/