Does anybody know how to get github ssh to work CORRECTLY on WSL (Windows Subsystem for Linux) in December of 2019


I need to run windows for video editing but I also do some coding. Linex is a beast and I would love to be able to use WSL on my windows computer and be able to do ssh from WSL. I am trying to start a thread where people can go to and follow the steps for WSL and Github ssh on windows. Can someone help me figure out what I am doing wrong so others can use WSL and Github as well?

My steps:

  1. Reset windows
  2. go to this site and install WSL
    I chose Ubuntu 18.04 LTS:
  3. set up and upgrade Ubuntu:
    sudo apt update && sudo apt upgrade
  4. Installed VS Code using this website:
  5. INstalled the Remote Development Pack:
  6. Set up gitbash on windows using defaults
  7. Set up git ssh with this site:
  8. Did a git clone made changes and pushed to master just to make sure everything work, It does.
  9. added a .gitattributes file to repo
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

(is there a way to make this automatic?)

  1. Then I ran this command because it suggested it on the site…
git config --global core.autocrlf input
  1. Git still works

  2. dis these steps to share credentials

Configure the credential manager on Windows by running the following in a Windows command prompt or PowerShell:

 git config --global credential.helper wincred
Configure WSL to use the same credential helper, but running the following in a WSL terminal:

 git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe"
  1. Ran git push from wsl and goterror:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.      

Please make sure you have the correct access rights
and the repository exists.

Git push works on windows side


Eureka I got it!!

After all the steps above go into your windows terminal and run:

$ ssh -T [email protected]

You should get:

You've successfully authenticated, but GitHub does not provide shell access.

Then on ubuntu enter:

$ cd
$ cd .ssh 
$ code .

This will open up your ubuntu .ssh folder in VS code.

Then open power shell and run:

> cd .ssh
> code .

This will open up your windows .ssh folder in VS code.

Then you can drag and drop your windows fils to ubuntu through vs code.

Now go back to your WSL terminal and run:

$ ssh -T [email protected]

If you get:

Permissions 0666 for '/home/andre/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/andre/.ssh/id_rsa": bad permissions
[email protected]: Permission denied (publickey).

Then run:

$ sudo chmod 600 ~/.ssh/id_rsa
$ sudo chmod 600 ~/.ssh/

Now when you run:

$ ssh -T [email protected]

You should get:

You've successfully authenticated, but GitHub does not provide shell access.

Answered By – André Jarboe II

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published