I needed to clone a repo from Gitea and I normally do it on my Mac but I don't have my Mac with me. I was able to clone the repo on Windows after placing the RSA key in the .ssh folder that's in C\Users\me while using Git Bash for Windows, but I could not do it with WSL. I then tried copying the files in the C\Users\me.ssh and placing them in the Linux file system's .ssh folder. Did not work. I tried deleting WSL .ssh folder and making it a symlink to the C\Users\me.ssh one, and still didn't work. How can I fix this?

1 Answer 1


I suppose it is permissions issue. The SSH keys are private data. In Ubuntu/Linux they must have restrictive permissions, so only the owner user can read them. You can set the proper permission by the following commands:

sudo chown -R "$USER:$USER" ~/.ssh # make sure the files are owned by the user
find ~/.ssh -type d -exec chmod 700 {} \; # set drwx------ permissions for the dirs
find ~/.ssh -type f -exec chmod 600 {} \; # set -rw------- permissions for the files
  • note, ~/ represents the user's $HOME directory, i.e. /home/<user>/.

Another possible trouble maker is the way you've created the files. In Windows, lines end with both the line feed and carriage return ASCII characters, but Unix uses only a line feed. In such case you can process the ssh key files by dos2unix or you can use some of the other approaches, shown here.

See also:

  • so the .ssh folder in my WSL home/me/.ssh should be 600 and each file at 700? I copied/pasted the text into the files. On my C\Users\me, it's 777 and Git Bash for Windows works fine. Why not for WSL?
    – AviG
    Sep 21, 2019 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.