Skip to content

Instantly share code, notes, and snippets.

@JamesSkemp
Created March 11, 2015 02:03
Show Gist options
  • Save JamesSkemp/c440ab5a1f6f0ef55620 to your computer and use it in GitHub Desktop.
Save JamesSkemp/c440ab5a1f6f0ef55620 to your computer and use it in GitHub Desktop.
Setup Git auth on a new Windows machine
# make sure poshgit and git are installed via Chocolatey (via admin)
choco list -l
# update PowerShell profile
notepad $profile
# add these lines at the top (to find ssh-agent)
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"
# reload profile
. $profile
# check Git config
git config --global -l
# update config accordingly
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
# prepare for Git 2.0
git config --global push.default simple
# generate an SSH key file
ssh-keygen -t rsa
# now browse to the id_rsa.pub file in the directory you just used and copy that.
# it should start with ssh-rsa
# paste that into GitHub as an SSH key
# https://github.com/settings/ssh
# you should be able to clone via the SSH link now
# if you screwed up, you can
git remote rm origin
git remote add origin git@github.com:xxx
git push --set-upstream origin master
# type yes if things look correct
# enter your passphrase from your SSH key generation
# should be set to go now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment