-1

I have a setup of Azure Devops Git, Nexus Central Repository and Jenkins. And my local codebase is in eclipse from where i would like run maven build later so that snapshots and releases gets uploaded to Nexus Repository later. But currently when i run builds in Jenkins Freestyle Item for the project i configured, where i have made an connection through SSH keys and Azure Devops Git repository personal tokens to Nexus Central Repository and Azure Devops Git location. Connection is successful and i am able to run build successfully in Jenkins i.e. able to pull all jars from Nexus. But at the end of Jenkins build, build report failure and Jenkins gives me an error

Unable to commit files
Provider message:
The git-push command failed.
Permission denied, please try again.

***@vs-ssh.visualstudio.com: Permission denied (password,publickey).
fatal: Could not read from remote repository.

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

i have generated RSA security keys under C:\Users***.ssh\ folder which has 3 files id_rsa(private key), id_rsa.pub(public key) and known_hosts. what i understand from the problem is, i needed to add the SSH key to my SSH agent(adding public key to my Azure Devops host and known_hosts file) so that my computer knows, how to try using it. I tried to run below command from Git Bash

$ ssh -i  ~/.ssh/id_rsa abc@***.visualstudio.com/ -v

and then i had an error as below

ssh: Could not resolve hostname **.visualstudio.com/: Name or service not known

i am not able to communicate on port 22 for ssh although i have configured Inbound/Outbound rules on Windows Firewall and made all port open. And i also made "HOME" User Variable in Environment variables pointing to my user home directory C:\Users***\ as per Jenkins SSH setup need.

Please assist me on this, as i am not sure where i am doing wrong.

Mohit Darmwal
  • 275
  • 1
  • 5
  • 21

1 Answers1

0

For the Windows machine, you have to create a config file inside the following directory /c/Users/PC_USER_NAME/.ssh/ where you can identify the key file for a specific host.

You can see the solution here: How to generate multiple SSH public key and configure those on windows machine from gitbash?

Fatema Tuz Zuhora
  • 3,088
  • 1
  • 21
  • 33