Github no longer allow password based authentication so SSH is the one way to avoid convoluted authentication via browser.
- Install git using .exe from GIT SCM download . Do not use winget or other options.
- Enable option for integrating git bash with windows terminal. See adding git bash to windows terminal for details.
- Follow github instriction to add new ssh key via git bash on windows to create new SSH key
- Go to ~/.ssh and confirm that new file got created.
- Follow Adding a new SSH key to your Github account to add newly created public SSH key.
- eval "$(ssh-agent -s)"
- ssh-add ./new_key_file
- copy content of ./new_key_file.pub in github account
Now, we can use git commands in the git bash terminal to interact with github.
To be able to interact with github in vscode, we need to start vscode from git bash. Check Github with vscode
- code .
- Open git bach terminal in windows terminal and run the commands as below
- eval "$(ssh-agent -s)"
- ssh-add ./new_key_file
- In VScode, open terminal and run below command
- cmd /c start-ssh-agent
Just doing start-ssh-agent in any powershell terminal starts a cmd shell which restricts ability of the powershell terminal. You can see in the vscode that the terminal type changes from posh to cmd.
Check out ssh-add on windows 10 for details on running ssh-agent automatically at startup.
Setting up personal key for bitbucket
Make sure that OpenSSH is installed. Details are in the above link.
Open powershell admin console and run below
- Set-Service -Name sshd -StartupType 'Automatic'
- Start-service ssh-agent
- Get-service ssh-agent
Open normal Powershell and run comamnds as follows
- cd ~/.ssh
- Generate keys as asked in the above link and add public key to bitbucket https://bitbucket.org/account/settings/ssh-keys/
- ssh-add ~/.ssh/{new-key-name}
- ssh-add -l
- notepad config
- Update config file as asked in earlier link