1
votes

I have a Visual Studio Online project working with Git. Everything works fine from inside Visual Studio. I'm trying then to configure a Jenkins job that gets the code from this project, but without success. Although the URL and the credentials are correct, Jenkins gives me this error on the job configuration page:

Failed to connect to repository : Command "git.exe -c core.askpass=true ls-remote -h https://[username]:[pwd]@[domain].visualstudio.com/defaultcollection/_git/[project] HEAD" returned status code 128: stdout: stderr: fatal: repository 'https://[username]:[pwd]@[domain].visualstudio.com/defaultcollection/_git/[project]/' not found

If I save and try to build, the build fails with the following error:

unable to access 'HTTP://https:///[username]:[pwd]@[domain].visualstudio.com/defaultcollection/_git/[project]/': Could not resolve host: https

Does anyone have any idea on what can I do?

Thanks

1
On the Jenkins server, are you able to clone your Git project with the https URL? Did you try with a ssh URL?Bruno Lavit
I have Visual Studio installed on the Jenkins server. On Visual Studio, I can clone the project using the HTTPS url, but on Jenkins the same url does not work.Ricardo Mendes
It's a private Git URL? Are you using some credentials with Jenkins to access this URL?Bruno Lavit
What do you mean by "private Git URL"? If you mean an internal server, it is not. It is Visual Studio Online. I've tried to follow the steps documented here: visualstudio.com/en-us/get-started/jenkins-and-vso-vs.aspxRicardo Mendes
Private Git URL = you need some credentials to access it. As I understand, you are using your Visual Studio Online to access this URL. Did you try to launch a git command line like (with DOS): git clone https://....?Bruno Lavit

1 Answers

2
votes

Well, I finally made Jenkins perform the clone of a Visual Studio Online git repository.

The official Microsoft documentation is wrong. Jenkins and the Git plugin do not work as they explain there. In order to the clone operation to work, I had to put on the repository URL field the same URL used for clone in Visual Studio: https://[domain].visualstudio.com/defaultcollection/_git/[project].

Additionaly, I had to add a credential on Jenkins with the username and password for the connection to be successful. I am using the alternate credentials in Visual Studio Online.

Thanks for all the help.