Skip to content

Instantly share code, notes, and snippets.

@MattHodge
Last active August 1, 2016 10:55
Show Gist options
  • Save MattHodge/b2eed7c9202af5c166d2 to your computer and use it in GitHub Desktop.
Save MattHodge/b2eed7c9202af5c166d2 to your computer and use it in GitHub Desktop.
03_Blog_Win10_Development_PC_Git.ps1
# Add Path Variable ssh-keygen path in the git folder - do this manually if you aren't using the function
Add-PathVariable -Path 'C:\Program Files\Git\usr\bin'
# Generate SSH Key - accept the defaults
ssh-keygen -t rsa -b 4096 -C "[email protected]" -P <SomePassPhrase>
# Add your key to the ssh-agent which will prevent you having to enter in the passphrase every time the key is used
ssh-add ~/.ssh/id_rsa
# Copy the contents of the key to the clipboard
Get-Content ~/.ssh/id_rsa.pub | clip
# Add your SSH Public key to your source control system (BitBucket, GitHub etc.)
# Configure your global git settings
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global push.default simple
git config --global core.ignorecase false
# Configure line endings for windows - more details here: https://help.github.com/articles/dealing-with-line-endings/#platform-windows
git config --global core.autocrlf true
# Test the connection - for example with GitHub
ssh -T [email protected]
# If you have problems with being re-prompted for the passphrase for your SSH key, try closing the ssh-agent process and all of your PowerShell windows and re-opening PowerShell. You should be prompted for the passphrase when the PowerShell session launches and that is all.
@MattHodge
Copy link
Author

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