Failed to connect to repository Jenkins setup version 2.249.1 - jenkins

Installed Jenkins and git on windows machine. when trying to set URL under source code management following error shown:
PATH enviornment variable
C:\Users\user\AppData\Local\Programs\Git\bin
Jenkins->ManageJenkins->global tool configuration-> git path set it as C:\Users\user\AppData\Local\Programs\Git
while trying to set URL as below:
https://github.com/User/EmployeeApp error shown below:
Failed to connect to repository : Error performing git command: C:\Users\user\AppData\Local\Programs\Git ls-remote -h https://github.com/user/EmployeeApp/ HEAD
Please help me to resolve this error !

Resolved by adding this
Jenkins -> Manage Jenkins -> global tool configuration
under Git
PATH to executable git -> C:\Users\user\AppData\Local\Programs\Git\bin\git.exe
cheers!

Related

apache tom cat jenkins error during creating job gitpull

Need help in jenkins following error appearing, when i am creating new item/job gitpull topcat apache
Failed to connect to repository : Error performing git command: git.exe ls-remote -h https://github.com/vishambardutt/samplewebapp.git HEAD
jenkins, job/item creation in tomcat

How to resolve the Jenkins Freestyle project Error : Filename too Long, Unable to create

I created a Jenkins Free Style Project to run a Rest assured Serenity Test Framework with Java.
When I click on Build Button in my Jenkins Job,
I get this error.
> git config core.sparseheckout # timeout=10
> git checkout -f 22227b72dd8derfgtxc7b72dd8derfgtxc7b72dd8derfgtxc # timeout=10
FATAL: Could not checkout 22227b72dd8derfgtxc7b72dd8derfgtxc7b72dd8derfgtxc
hudson.plugins.git.GitException: Command "git checkout -f 22227b72dd8derfgtxc7b72dd8derfgtxc7b72dd8derfgtxc" returned status code 128:
stdout:
stderr: error: unable to create file src/main/resources/apiRequest//createLoa/Associdksjdksjdksjdksjdksdjjdkjdks.json: Filename too long
error: unable to create file
I know that file name is too long,
I am using SHELL option as a build step with below given parameters
export MAVEN_HOME=/opt/maven
export PATH=$PATH:$MAVEN_HOME/bin
mvn --version
mvn clean package
mvn clean install
can I add something here to resolve this error? Please suggest an alternative

Jenkins #Library resolution failing due to git.exe not existing, but where?

I have this command at the top of my pipeline file, and my build failed immediately in Jenkins while trying to resolve it:
#Library('MyLibrary') _
pipeline{
...
I also have this library setup in my global jenkins config. Triple checked it.
The Jenkins log is below... the internet says this happens when git.exe is misconfigured or not found. We have 100% verified git is installed on all the slaves. However, I suspect that this failing git clone is running somewhere else since the pipeline has not officially started yet (we don't see RUNNING ON: blah in the log).
So... Does it run this on the master? We have master set to 0 executors, and git is not installed there.
Is this problem solved as easily as installing git on the master? Or is there some other magical place where these #Library includes get cloned?
Here is the Jenkins log output, with names changed to protect the innocent:
Started by user Me
15:28:23 Connecting to my github url
Obtained Jenkinsfile from blah
Running in Durability level: MAX_SURVIVABILITY
Loading library MyLibrary#master
Examining <my github repo>
Attempting to resolve master as a branch
Resolved master as branch master at revision blah
No credentials specified
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository <my repo url>.git
> git init /home/afolder/jenkins/workspace/<git repo name>#libs/MyLibrary # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /home/afolder/jenkins/workspace/<git repo name>#libs/MyLibrary
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:813)
...
Caused by: java.io.IOException: Cannot run program "git" (in directory
"/home/afolder/jenkins/workspace/<git repo name>#libs/MyLibrary"):
error=2, No such file or directory
Yes, by default it will run on the Jenkins master.
Please follow the link for more info.
You can read library file and give the file to writeFile pipeline step
writeFile(file:"foo.groovy", text: libraryResource("bar.groovy"))
"groovy foo.groovy"

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

I have installed jenkins on my centos7 server and tried to build a maven build. Created a new maven build job and in SCM I was trying to pull the code from github but it showed me an error like...
Failed to connect to repository : Command "git ls-remote -h https://github.com/example.git HEAD" returned status code 128: stdout: stderr: remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/example.git/'
And also I setup an SSH public keys to my github. I don't know how to solve this. Anyone help me.Thanks in advance.
also I setup an SSH public keys to my github
That would have zero impact on an HTTPS URL: the SSH key is ignored.
Check if you havbe a git credential helper in place which might cache your credentials (GitHub username/password)
git config credential.helper
For instance, it could be 'cache'.
I would recommend (as in this answer) to set it to gnome-keyring:
git config --global credential.helper gnome-keyring
Then try again your git ls-remote, from command-line:
git ls-remote https://<yourUsername>#github.com/<yourUsername>/<yourRepo.git>
That should prompt for your GitHub username/password. Once entered, a second git ls-remote should not ask again for your credentials.
From there, an SCM process from your Jenkins, as long as said Jenkins runs with your account, should work.

Error when deploying Lektor site to Github Pages using Travis CI

I've got a Lektor site that I'm trying to deploy automatically in response to pull requests and commits, using the Travis CI trigger approach from the Lektor docs.
The Lektor configuration works fine from the command line.
The Travis build starts, and appears to build the site without problem - but when it gets to deployment, the log says the following:
Installing deploy dependencies
!!! Script support is experimental !!!
Preparing deploy
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment/#Uploading-Files.
No local changes to save
Deploying application
Deploying to ghpages-https
Build cache: /home/travis/.cache/lektor/builds/d3a411e13041731555222b901cff4248
Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
Initialized empty Git repository in /home/travis/build/pybee/pybee.github.io/temp/.deploytemp9xhRDc/scratch/.git/
Fetching origin
fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
error: Could not fetch origin
fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
Done!
For a full log, see here.
I've checked the credentials in the Travis CI configuration for the repository; I'm as certain as I can be that they're correct. I've tried using the same configuration (exporting LEKTOR_DEPLOY_USERNAME and LEKTOR_DEPLOY_PASSWORD locally), and it works fine.
hammer:pybee.org rkm$ lektor deploy ghpages-https
Deploying to ghpages-https
Build cache: /Users/rkm/Library/Caches/Lektor/builds/a269cf944d4302f15f78a1dfb1602486
Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
Initialized empty Git repository in /Users/rkm/projects/beeware/pybee.org/temp/.deploytempOh4p98/scratch/.git/
Fetching origin
From https://github.com/pybee/pybee.github.io
* [new branch] master -> origin/master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Everything up-to-date
Done!
Any suggestions on the cause of this error?
It turns out this is a bug in Lektor.
If you use the following in your <project>.lektorproject:
[servers.ghpages-https]
target = ghpages+https://pybee/pybee.github.io?cname=pybee.org
and the following in your .travis.yml:
language: python
python: 2.7
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/lektor/builds
install: "pip install git+https://github.com/singingwolfboy/lektor.git#fix-ghpages-https-deploy#egg=lektor"
script: "lektor build"
deploy:
provider: script
script: "lektor deploy ghpages-https"
on:
branch: lektor
(i.e., use the PR branch for deployment), builds will deploy as expected.

Resources