Failed to connect to repository : Command “git.exe ls-remote -h – - jenkins

I’m getting error in configuring connection between Jenkins and GitLab.
I created Access Token in my GitLab remote repository and added it in Jenkins as Credential (Manage Jenkins > Manage Credentials > System > Add Credentials) but still connection between Jenkins and GitLab fails and brings error as attached screenshot shows.
I’m using Windows.

Related

Jenkins can not connect to git repository over ssh

I'm very new with Jenkins, and I'm trying to learn how to use it. I have setup the Jenkins on my small Windows-based server, and I have another server (raspberry) where I have initialized a small git project. When I try to add this git repository to the Jenkins, it can not connect to it no matter what. Here's what I have tried so far.
I can check, that the connection is working to the git server by using git ls-remote -h ssh://gitserver#192.168.50.152:22/home/gitserver/GitProject/.git command from any computer within the network, and I get a response after giving my password. I have saved this password as a "Username with password" -kind to Jenkins > Manage Jenkins > Credentials. Then, I have selected this from the Credentials drop down, but all I get is this error: "Failed to connect to repository : Error performing git command: git.exe ls-remote -h ssh://gitserver#192.168.50.152:22/home/gitserver/GitProject/.git HEAD"
Interesting part is, that if I try that command given with the "HEAD" at the end, I get just empty line, but no errors. Could this be an indicator to some kind of an issue? Here's a picture of the configuration. Am I doing something wrong? I have SSH authentication right now via password and ssh-public key. I have tried the SSH-public key as a credential, but no luck.
I'm very new to Jenkins, and just starting to learn, but I could not find an answer to this. Many articles were just pointing out how to connect to GitHub project, but I want to connect to this local project sitting on a raspberry pi, as an exercise.
Ok, the issue was with Jenkins and specifically with the SSH plugin it is using to connect. After updating everything, and Jenkins restarted, the connection is now working, and I can confirm this by clicking the "Build Now", and checking the Build log, Jenkins did fetch the info from the Raspberry server, and it is now sitting at the data-folder of this server!
So, for the rest of the people having this issue, try to update all plugins and then restart the Jenkins.

Jenkins on Linux Server Behind VPN Not Connecting to GitHub Webhook

I'm setting up continuous integration of a GitHub repository to automatically be pulled down by Jenkins onto a Linux server that is behind my company VPN that I do not control.
I have setup an Private SSH Key as both Jenkins Credentials and GitHub Deploy Key. I keep getting authenticating errors when Jenkins tries to connect to the SSH Repository URL. Is the VPN causing GitHub to not be able to POST to the server? Or am I missing something else?
ERROR MESSAGE:
Failed to connect to repository : Command "git ls-remote -h git#github.com:MyOrganization/MyRepository.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Jenkins: Git Failed to connect to repository, returned status code 128

I'm attempting to clone a remote GitHub enterprise repository and am running into the following error after adding my remote repo's URL to the Git Plugin in my Jenkins configuration:
Failed to connect to repository : Command "git.exe ls-remote -h https://<<server>>/M/AS.git HEAD" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://<<server>>/M/AS.git/': Received HTTP code 502 from proxy after CONNECT
Firs of all You Need to setup github with jenkins in below section also
Go to Github --> click on profile dropdown --> settings --> devloper settings --> personal access token -->
generate new token --> select all scopes --> copy the token
Then go to Jenkins --> manage Jenkins --> github settings --> add user --> Select secret text--> paste the token
Then Test the git-hub connection by clicking test button If its Successful the Jenkins will ready to clone the GitHub repository
And also add Webhooks, Integrations & Services in GitHub
Make sure you have generated Git API Token in Git repository and added the same in the Jenkins Credentials.
If the is done, I don't think there will be any issue in connecting Git to Jenkins.
Also you can test if your Git server is able to ping your Jenkins server. (If you are running your own Git and Jenkins).
All the best.
Check your failed job environment variables.
If there is no environment variable named NO_PROXY, set one in the configuration of your JENKINS job:
NO_PROXY=.mycompany.com
Here, I assume your GitHub Enterprise has an URL like myserver.mycompany.com (replace (mycompany.com by your own)
That will avoid Jenkins trying to access the remote server through the proxy.
If you are running from a VM, make sure you install the package 'git-core'.
You must have git installed in the machine where jenkins is running
I had the same issue and for me it helped a restart for the machine where it was installed Jenkins.

Jenkins Gitlab Localhost - Failed to connect to repository : Command "git ls-remote -h

I am trying to connect Jenkins with GitLab, both are installed on the same Unix server, in Jenkins Manager System the connection is successful. But in Job when I put the URL in the Repository URL it gives an error message:
"Failed to connect to repository: Command" git ls-remote -h "
We are trying via http: // localhost, but we have already tried to use the domain https://git.MYCLIENT.org.br/REPOSITORY.git, we also have SSH, we use PRIVATE KEY SSH, we use ACCESS TOKEN from GIT, we have done all settings to do. Even so, continue with this mistake!

Connection issue with Jenkins within Docker on RaspberryPi 3 (rpi-jenkins) when cloning a Bitbucket Git Repo

I'm currently playing around with Jenkins on Raspi within Docker (using dilgerm/rpi-jenkins image).
Now I have a problem with connecting to a Bitbucket Git repository.
When entering the repository url, I get (the commonly known) "Failed to connect to repository"
When using https and providing credentials (via Jenkins Credentials store), I get the error.
When using ssh and configuring the keys properly, I get the same error.
Now I am wondering if I have to configure the ssh-key withing the docker container (for the Jenkins user?). Currently, I have implemented the key on the hosting Raspi itself.
Or may it be required to configure/publish the ssl port of the Docker container on startup (-p parameter)?
Any help appreciated.

Resources