Skip to content

Instantly share code, notes, and snippets.

@AdamMagaluk
Created September 17, 2013 14:42
Show Gist options
  • Save AdamMagaluk/6595271 to your computer and use it in GitHub Desktop.
Save AdamMagaluk/6595271 to your computer and use it in GitHub Desktop.
Git Windows Primer

Resources on What Git is and how to use it

Setting up Git on Windows

  1. Download Git for Windows http://git-scm.com/download/win
  2. Run installer
  3. Open "Git Shell"
  4. Type ssh-keygen.exe to generate ssh keys to /C/Users/USERNAME/.ssh
  5. Copy the contents of /C/Users/USERNAME/.ssh/id_rsa.pub to your clipboard, open it using notepad or something else. Will look similar to:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwHoPKasdasdbjXjixG8K4hiMXtGpkNRtIWwrlwNlmTu24QECjNJirNJtD+VvENA3FdeWU1admv6P0o2dCAw3QDBSBJhlwUs+CEcGbx6GdcX7W4I3xaCowrBBpHh+HmggLqorrLmenU8atP4FGBwv5tl1KIgHNEwtpH9l34NQmbGDcVQUss2JVZ0v19feRFa1231N9CkgMCjxZPhV2+eW7FUym+CgR2qJmfEEuhztFnitARUiab37lYJ0+M7Mxx7x2f1SIxptUtivbRt+AiD+RMAbQhfcjhy5eOPD+djV3CaZ0SocrK3K0hrCTjgU9AqnsqlFREG0vfMgNRuUaSgRtWQ== USER@USER-PC
  1. Config email and name. In the "Git Shell"
git config --global user.name "John Doe"
git config --global user.email "[email protected]"
  1. Log into https://git.example.com/
  2. Navigate to add key section of website https://git.example.com/profile/keys/new
  3. Name the key and paste the contents of step 5 into the bigger box.

Creating a new project

  1. Navigate to the new projects page (https://git.example.com/projects/new), or from the home screen there is a button on the right that says "New Project"
  2. Name it and add a description... Namespace deals with permissions and associated repositories. Currently there are two I use, Intellistreets to house all production/developement repositories that deal with the core Intellistreets product. Blue light button is exactly that blue light stuff. You can also create a repo in your personal namespace, for minor stuff that doesn't need to be shared with everyone.
  3. Follow the example instructions
mkdir test-project
cd test-project
git init
git add .
git commit -m 'first commit'
git remote add origin [email protected]:AdamMagaluk/test-project-2.git
git push -u origin master

Working on an existing project

  1. Find git ssh url for project should look similar to [email protected]:AdamMagaluk/test-project.git

  2. Run in the "Git Shell" git clone [email protected]:AdamMagaluk/test-project.git will checkout project into a folder test-project

  3. Navigate into test project cd test-project

  4. For development you should be working in a development branch, you can create one by running git checkout -b adammagaluk/devel or if already created git checkout adammagaluk/devel

  5. git status to check changes to working directory.

  6. git commit -a to commit working directory to repo.

  7. git push to push all new commits from current branch to origin server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment