Git – Initialize your Local Git Repository

Rails project works well with Git. A .gitignore file can be found in a freshly created Rails project. It would be good to setup the local Git repository before you start the development.

1. First, install Git

  • apt-get install git-core


2. Setup your Git user account.

  • git config –global “Your Name”
  • git config –global


3. Also setup the default text editor for Git.

  • git config –global core.editor “vi”


4. Go to your Rails project root directory and add the following ignore paths in the .gitignore file.

# Default ignore paths

# Newly added


5. Initialize the local Git repository.

  • git init


6. Go to the Rails project root folder and add all files to the local Git repository.

  • git add .


7. Compare the working tree with the repository. There will be many new files which we just added.

  • git status


8. Commit all the newly added files.

  • git commit -m “First commit =)”


9. Check the status again, there should be nothing to commit. You can also check the commit log by the git log command.


Done =)

Reference: Ruby on Rails Tutorial – 1.3 Version control with Git


2 thoughts on “Git – Initialize your Local Git Repository”

  1. I’m not sure if you can help me with this at all. To make a LONG story short: I’m attempting to jailbreak my kindle (3gb wi-fi) & in order to do that I need to set up SSH key access. I have NO knowledge of code & after trying this for 1.5 days (searching the internet for hours & rebooting my kindle too many times to remember) I figured it was time to ask someone who knows about computers (whew!). Anyway, I’m using GitHub ( & it says failed everytime I try to generate a new SSH key.
    These are some of the codes I’ve tried entering:
    (/Users/C/Documents and Settings/CRW/My Documents/.ssh/id_rsa):
    Can you PLEASE help me out. . . what am I doing wrong?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.