Part1GitSetup - xorkevin/GitIntroduction GitHub Wiki

#part 1: git set up

##Download git

  1. go to http://git-scm.com/ and hit the huge download button.

  2. run the installer and once you get to the Select Components section, make sure the following are selected:

    • Windows Explorer integration
      • Advanced context menu (git-cheetah plugin)
    • Associate .git* configuration files with the default text editor
    • Associate .sh files to be run with Bash
  3. when confronted with the Adjusting your PATH environment section, select:

    • Use Git from the Windows Command Prompt
  4. on Configuring the line ending conversions, select:

    • this for windows

      • Checkout Windows-style, commit Unix-style line endings
    • this for mac / linux / unix - based

      • Checkout as-is, commit Unix-style line endings
  5. congratulations, git is set up.

##create a Github account

self explanatory...

  • quick note: Github is not the same as git. git is the open source software that you just downloaded. Github is the most popular host for hosting git projects.

##cloning a repository onto your computer

  1. create a directory called TestRepo somewhere on your computer (though not necessary, it is good to have the directory name match the repository name for clarity)

  2. navigate to the directory, right click inside it and select the option git bash

  3. you should be presented with:

user@computername /C/path/to/your/TestRepo $ ```

- the dollar is a prompt saying that one can type there
  1. type in the command line

git init ```

and press enter. this initializes git inside this directory.
  1. now one should see

user@computername /C/path/to/your/TestRepo (master) $ ```

- notice "(master)". this indicates branch name, which we will go into later.
  1. go to the right sidebar of the TestRepo repository page where there is a box

You can clone with HTTPS, SSH, or Subversion. ```

and click on HTTPS and copy the url in the box
  1. type in the command line

git remote add origin the url that you copied ```

- hint: you can paste by pressing the insert key after copying some text.
- this command tells git that there is an remote repository at the specified url and gives it the name origin (by convention, origin is the name of the main external repository used)
  1. then type

git pull origin master ```

- this tells git to go to origin (which is the remote repository you specified earlier) and find the master branch. it will then pull the contents from that branch to your current local branch (which is master, if you remember from step 5). To reiterate: you are pulling contents from the server (origin) onto your local machine.
  1. type

git branch -u origin/master ```

- NOTE: MAKE SURE YOU HAVE THE "/"
- this tells git that the current branch you are on (master), should track the branch in origin called master.