Instructions to install git for your local development environment.

Contents

git docs

Installing git

  • Windows:
    1. Download from Git Download
    2. Once downloaded run the installer and choose the following option, this gives you useful linux commands like ls, chmod
    3. Once installed you get the following, but you can run git from the windows dos prompt (Run the git-bash once and all the git and linux commands will be added to the windows path)
  • Mac OS X:
    1. Download from Git Download
    2. Once installed you should be able to run git from the path
  • Unix/Linux
    1. Install
      sudo apt-get install git
    2. Optional
      sudo apt-get install git-gui

Setting up ssh keys

  1. Commands are the same for all OS
    ssh-keygen -C "your@email.com" -t rsa
  2. Select location of id_rsa file: You copy the same location of the file that it suggests, you can leave passphrase blank.

Repository setup

Either using Assembla.com or GitHub you need to give them your generated public key.

  • Assembla.com, copy the line from id_rsa.pub to this Your Assembla Profile
    • For Assembla project owners: Go to your project space and "Git & Trac" tab and then you can add all your team public keys by clicking on "Add more ssh keys", once the keys are added click on "Update Git settings" and then "Synchronize team ssh keys" (Owners will need to do this if they change their own ssh keys)
  • Github.com, copy the line from id_rsa.pub to your account settings
    • You can add more ssh keys when you have more then one person working with a repository

git commands

  • Global setup that all git users should do once after the installing git
git config --global user.name "username"
git config --global user.email name@domain.com
  • How to create/push/clone git repository
create
mkdir project
cd project
git init # Creates a git repository
git add * # Add files that you want to commit
git commit -m "Commit Message"
push
git remote add gitRepoName git@gitserver.com:yourproject.git
git push gitRepoName master # pushes the master to the server
clone
git clone gitRepoName # Downloads the current version of the repo 
  • git help commands
git help # gets all commands
git help add # Will give the manual page for add

git tutorial links

git and svn

Dancing between github and subversion repository