Skip to content

Instantly share code, notes, and snippets.

@frank-leap
Last active August 29, 2015 14:19
Show Gist options
  • Save frank-leap/8ee812c4553cc2fa6b19 to your computer and use it in GitHub Desktop.
Save frank-leap/8ee812c4553cc2fa6b19 to your computer and use it in GitHub Desktop.
Setup Git on Windows
# Install Git from http://git-scm.com/ and then launch Git Bash
# Generate SSH key pair
ssh-keygen -t rsa -C <username>@gmail.com
#Turn on SSH agent
ssh-agent -s
eval $(ssh-agent -s)
# List SSH keys registered in the SSH agent
ssh-add -l
# Add generated SSH key to the SSH agent
ssh-add /c/users/<username>/.ssh/id_rsa
# Copy SSH public key into clipboard and then register it into Git system
clip < /c/users/<username>/.ssh/id_rsa.pub
# Test host connection
ssh -T git@<host>
# External examples: ssh -v git@bitbucket.org or ssh -v git@github.org
# Setup Git profile
git config --global user.name = "<first name> <last name>"
git config --global user.email = <username>@gmail.com
git config --global color.ui = true
# Update .bashrc to avoid starting ssh-agent and adding SSH keys everytime:
#! /bin/bash
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa
# In case the Git repository has been cloned using HTTPS then to avoid entering the credentials everytime
git remote set-url origin git@<host>:<project>.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment