When the warehouse on the Gitlab is used with Jenkins, permissions fail and inaccessible situations such as printing the following information are always present:
Started by user Lhy building in workspace/usr/share/tomcat8/.jenkins/workspace/zxpm > Git rev-parse--is-inside-work- Tree # timeout=10 fetching changes from the remote git repository > git config remote.origin.url git@192.168.1.2:web/z Xpm.git # timeout=10 fetching upstream changes from Git@192.168.1.2:web/zxpm.git > git--version # timeout=10 using GI T_ssh to set credentials > git-c core.askpass=true fetch--tags--progress git@192.168.1.2:web/zxpm.git +refs/heads/ *:refs/remotes/origin/* error:error fetching remote repo ' origin ' hudson.plugins.git.GitException:Failed to fetch from G It@192.168.1.2:web/zxpm.git at Hudson.plugins.git.GitSCM.fetchFrom (gitscm.java:799) at HUDSON.PLUGINS.GIT.GITSCM.R Etrievechanges (gitscm.java:1055) at Hudson.plugins.git.GitSCM.checkout (gitscm.java:1086) at Hudson.scm.SCM.checkou T (scm.java:485) at the Hudson.model.AbstractProject.checkout (abstractproject.java:1269) at hudson.model.abstractbuild$ Abstractbuildexecution.dEfaultcheckout (abstractbuild.java:604) at Jenkins.scm.SCMCheckoutStrategy.checkout (scmcheckoutstrategy.java:86) A T Hudson.model.abstractbuild$abstractbuildexecution.run (abstractbuild.java:529) at Hudson.model.Run.execute ( run.java:1741) at Hudson.maven.MavenModuleSetBuild.run (mavenmodulesetbuild.java:531) at Hudson.model.ResourceContr Oller.execute (resourcecontroller.java:98) at Hudson.model.Executor.run (executor.java:410) caused by: Hudson.plugins.git.GitException:Command "Git-c core.askpass=true fetch--tags--progress git@192.168.1.2:web/ Zxpm.git +refs/heads/*:refs/remotes/origin/* "returned status code 128:stdout:stderr:permission denied, please try Aga
In.
Permission denied, please try again.
Permission denied (Publickey,password).
Fatal:could not read from remote repository.
Please make sure your have the correct access rights and the repository exists. At Org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn (cligitapiimpl.java:1740) AT Org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials (cligitapiimpl.java:1476) at org.jenkinsci.plugins.gitclient.cligitapiimpl.access$300 (cligitapiimpl.java:63) at Org.jenkinsci.plugins.gitclient.cligitapiimpl$1.execute (cligitapiimpl.java:314) at Hudson.plugins.git.GitSCM.fetchFrom (gitscm.java:797) ... One more Error:null finished:failure
The problem only needs to be more careful. When configuring the Jenkins project, select Git in source management (provided that you have installed Git plugin), fill in the Warehouse address, and click Add, as shown
In kind select SSH Username with private key, the following private key select Enter directly direct input in Gitlab deployed public Key corresponding to the private key can be. General public key is in ~/.ssh/id_rsa.pub, and private key is ~/.ssh/id_rsa.
Click OK to save the project and build it again.