We have Jenkins installed and want it to pull from bitbucket and github – authorization should happen through Open SSH (Public Keys).
Jenkins runs as Local System.
How to find and then place id_rsa into ~/.ssh? How to get it to add things to ~/.ss/known_hosts?
As always: fake it until you make it!
- Run this command in an elevated command prompt on the server, in order to start a command prompt as Local System user:
sc create testsvc binpath= "cmd /K start" type= own type= interact && sc start testsvc & sc delete testsvc
The Interactive Services Detection will now bring up a dialog (probably in the background) where it asks you to “View the message” in order to display the service session where the command window will run.
- Run echo %userprofile% to see where your storage is… In my case it is "C:\Windows\system32\config\systemprofile”.
Odd, but true: Sadly, when i try to put the id_rsa file into that directory from my normal user session, it somehow doesn’t make it into the local system accounts profile.
- From here you can open the git bash by running C:\Program Files (x86)\Git\bin\sh –login –i
- Then run cd ~ to switch to your home directory.
- Then copy your id_rsa file here with a simple
cp <id_rsa-location> .
- Now run ssh firstname.lastname@example.org in order to try to authenticate and accept the host as known host.
BTW: also make sure you run git.cmd, not git.exe!!
Other posts that helped (and confused) me: