I'm just starting to look at Jenkins CI on my Windows 7 machine.
I thought for a first test I would create a git repo on my localhost which is aliased to
http://tests.local/jenkins/local
I setup a job in Jenkins, selected Git under source code management and added http://tests.local/jenkins/local.git as the Repository URL
When the job runs it fails with the error
ERROR: Error cloning remote repo 'origin' : Could not clone http://tests.local/jenkins/local.git
Is this a git issue or a Jenkins issue and how can I fix it?
Thanks
Have you run git update-server-info in your repo? This is needed if you want to clone/fetch via http. Run git help update-server-info or see online documentation here for more details.
Related
I am currently installaing a pipeline for my Visual Studio projects with Jenkins (on Windows).
I installed the Git Bash and Jenkins successfully, but when I generate a new Jenkins project I need to give a Repository URL. I entered the path to my project and got the following message:
Failed to connect to repository : Error performing command: git.exe
ls-remote -h file:///Users/myusername/Documents/Visual Studio
2015/Projects/QtTestApplication HEAD
I already searched for a solution and changed the user from Jenkins to the admin:
Jenkins configuration of git plugin
I double-checked the userchange in the Jenkins systeminformations (it's really running on the admin).
However i still get the same error as before and I'm not quite sure what to enter in this form.
I already tried "escaping" the whitespaces like this:
Failed to connect to repository : Error performing command: git.exe
ls-remote -h file:///Users/myusername/Documents/Visual\ Studio\
2015/Projects/QtTestApplication HEAD
EDIT: Solution Part 1
I found out, that git was not found by Jenkins and that i had to add it manually to it (edit the PATH variable).
I have a strange behaviour with git on Windows.
Some information
Windows 7
git version 1.9.5-preview20150319
If I try to clone a repository from the git bash with the http protocol like:
git clone http://myhost/myRepository
I get the error
fatal: Authentication failed for http://myhost/myRepository
If I clone the repository with the egit Eclipse plugin I'm able to clone it.
Also If I try the same command on ubuntu (from the same machine, in a virtual machine), I'm able to clone the repository.
Any help to be able to use the bash console in windows? need it for some initial setup.
Thanks in advance
Try to add [credential] section in your gitconfig
[credential]
helper = !\"C:/{msysgit-installation-path}/libexec/git-core/git-credential-wincred.exe\"
[http]
sslverify = false
You can use git config --global -e to edit your git config
For anyone else having this problem, prefacing my username with my htdigest realm ('REALM\USERNAME') fixed it for me. For some reason, it appears that the Linux client and others figure this out for you but the Windows client requires you to specify it explicitly.
Which is the correct installation directory for Jenkins to use? Here are the options I have tried and the results I have seen.
C:\Git\bin\git.exe
C:\Git\cmd\git
same as above
C:\Git\cmd\gitk.cmd
If I continue and ask the job to build here is the console output.
Started by an SCM change
Building in workspace C:\Jenkins\workspace\git_test
Checkout:git_test / C:\Jenkins\workspace\git_test - hudson.remoting.LocalChannel#12f2468
Using strategy: Default
Cloning the remote Git repository
Cloning repository ssh:///jenkins#xxxx.yyyyyyyyy.com:test.git
git --version
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Fetching upstream changes from origin
Seen 0 remote branches
No candidate revisions
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Since they all result in one error or another its not clear which one is correct.
This is not a problem with git not being found but that putty has not yet been told that it can trust the ssh-key presented by the repository sshd server.
Run a manual git command first on the Jenkins server, so you can say yes to accept the host key, and then try again.
We're using Teamcity 8.0.1 (build 27435). Having this exact same problem. Trying to connect to a bitbucket repo and getting the following exception intermittently:
Failed to collect changes, error: List remote refs failed:
org.eclipse.jgit.errors.TransportException:
https://username#bitbucket.org/myproject/project.git: -1 null
Behind a proxy server and I have added -Dhttps.proxyHost=XXX -Dhttps.proxyPort=1234 to the TEAMCITY_SERVER_OPTS environment variable. That didn't work. There was mention of trying to upgrade to Java7 on another forum but that also didn't help.
Unfortunately, we're not able to use SSH to bitbucket because of the company network rules.
Anyone solved this problem or have suggestions? Thanks for the help!
Im not sure if there a bug in Teamcity/Jgit, but HTTPS for Bitbucket is not working properly. The solution here was to use SSH, but thats not an option for me.
My solution for now is to clone the repo locally (git clone --mirror) and update it periodically in bash (git remote update). Then just point TeamCity to that local .git folder.
I get this error when configuring git repo in a new jenkins project:
Failed to connect to repository : Error performing command: ls-remote -h file:///c:\Dev\git\rx HEAD
I have a local git repo on my windows machine and cloning the same path from command prompt works on the same machine. I don't know what could be the problem (git.exe is on system path)
Windows installs Jenkins as a service. But it runs the Jenkins service under different user permissions that don't have access to GIT. You can follow this link to find the user that Jenkins runs under. http://antagonisticpleiotropy.blogspot.com/2012/08/running-jenkins-in-windows-with-regular.html
For example. My local user name on my windows is "nathandrewsire", exclude the quotes. Open windows services manager (either cmd and c:\services.msc, OR use windows key + R). Enable Log On > This account:. Then type in .\username (e.g. .\nathandrewsire). Then restart the service and you will have access to GIT from Jenkins builds.
I also found a snippet for windows shell command that will output the user to verify it.
echo %PATH%
echo %USERDOMAIN%\%USERNAME%
http://antagonisticpleiotropy.blogspot.com/2012/08/running-jenkins-in-windows-with-regular.html
Linux
If you're using Linux, this error can also be caused from not enabling share on your Git repo. Linux jenkins user won't be able to access Git report under another user unless....
git --bare init --shared=group
Also, your jenkins user and Git repo user must belong to the same group for file permission access. There's other alternatives to that like messing with umasks and ACL's but setting up a linux group for your two users is the easiest way.
Make sure NOT TO OVERWRITE your Git repo with the bare init command. If you already have a Git repo, you'll need to setup/move to a new one with the shared option. I didn't see a way to convert existing repos to shared because I am guessing the files would all need to be updated?
NOTE***
I used VMWare Workstation shared folders to build on a windows guest. Jenkins needs the following format when entering the Git repo.
//vmware-host/Shared Folders/vm-share/ridcyDevelopment.git/
Unable to get Jenkins and Git to play nice