Trouble Importing Package Via Git SSH URL - Cannot Spawn C:/Windows/System32/: Permission denied

Hi all,

I’ve been in the process of making the code I reuse across projects its own proper package that’s nicely integrated with the Package Manager. I’ve decided to go down the route of hosting it as a private repo on GitHub, and then I intend to add it to my packages via an SSH URL.

I’m running into an error that’s not mentioned in the Manual, and Googling it hasn’t helped thus far. I’m not particularly knowledgeable about Git from the command line, or SSH in general, which is making it a struggle to diagnose and solve on my own.

I followed the steps outlined in this Manual page: Unity - Manual: Loading SSH keys automatically on Windows (OpenSSH)

Starting with the GitHub guides mentioned within, I checked for existing SSH keys, I created one, and then I added the key to my GitHub account. I did not give a passphrase to the SSH key.

I then followed the rest of that Unity Manual page. I created and wrote the config file (no file extension, correct?), did the PowerShell operations (as admin), and created the GIT_SSH_COMMAND system environment variable (and I’m certain the path is correct with forward slashes as mentioned).

When the Package Manager fails to import the package, it generates this error:

Unable to add package [git@github.com:RobertJClose/RobboCode-Reusables.git?path=/Assets/RobboCode/]:
  Error when executing git command. error: cannot spawn C:/Windows/System32/: Permission denied
  error: cannot spawn C:/Windows/System32/: Permission denied
  fatal: unable to fork

My instinct is that it sounds like Git can’t access the OpenSSH executable, but maybe Permission denied refers to some failure in the SSH process instead. I’ve tried but don’t know enough to move forward.

Thanks to anyone who can offer some assistance.

Does importing any git url work?

This sounds like an incomplete path. Probably intends to run some .exe in that folder but the executable name is missing. Or it was misdirected to the System32 folder.

Did you install the git command line tools? If not, do that and reboot.

Okay, as the library is actually basically empty, I’ve made it public for the time being, so I can try a few more things.

Yes I was able to import with an HTML URL, but even with it public it failed to import via SSH. This is now the error instead:

Error when executing git command. no such identity: C:\\User\\robbi\\.ssh\\id_ed25519: No such file or directory

Ahhh… the problem is in the .ssh/config file, which one is guided into writing on this page. I typo-ed User instead of Users in the path.

After fixing that, I can succesfully import via an SSH URL whether the repo is public or private!

Super simple fix, and a silly mistake by me. But it’s the kind of thing that can happen. The original error log I got was not at all revealing. Might be worth adding to the Troubleshooting documentation how if you make this path mistake, that’s why you’ll see that error.

Hopefully this discussion helps someone in the future.