Is handy to use SSH while connecting to git, for better security and the advantage of not having to type passwords at every remote operations.
Here the instruction on how to set it up for Windows:
Generate the ssh key
- using the command prompt, go to
C:\Program Files (x86)\Git\binor
- generate the key pair using
ssh-keygen, leave the key name as default
Upload the key to github
- Go to
- open the file
id_ssh.puband copy the content
- go to your account in github, and under the SSH Keys tab, enter a new key. Paste your public key and give it a friendly name
Set up ssh for git
- Copy the path of the
ssh.exeexecutable under your
- Create a new environment variable called
GIT_SSHand set it to the path of the
- Now just clone your repository using the SSH link, rather than the http(s) ones.
- If everything was setup correctly you shouldn’t be requested a username or password.
- The first time you clone, SSH will ask you to confirm the ssh fingerprint of the remote server
Other git hosts have support for SSH. If you use Stash for example, just copy and paste your id_ssh.pub content into a new SSH key under your account preferences.