[英]How to solve the problem that the Jenkins pipeline syntax on the remote server cannot git clone the project
I want to deploy jenkins on a remote server, when I push the code to the repository, Jenkins builds automatically.我想在远程服务器上部署 jenkins,当我将代码推送到存储库时,Jenkins 会自动构建。
I have uploaded ssh to github and can connect using terminal.我已将 ssh 上传到 github 并可以使用终端连接。
ssh -T git@github.com
Hi admin, You've successfully authenticated. but GitHub does not provide shell access.
In jenkins, I use Pipeline script from SCM
to monitor git push events.在 jenkins 中,我使用
Pipeline script from SCM
来监控 git 推送事件。
Credentials I choose to use SSH Username with private key
, and fill in the private key of the ubuntu remote server, but when I try to build,an error occurs.凭据我选择使用
SSH Username with private key
,并填写ubuntu远程服务器的私钥,但是当我尝试构建时,出现错误。
The error message is as follows:错误信息如下:
Started by user iyao
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune -- origin +refs/heads/iyaomz:refs/remotes/origin/iyaomz" returned status code 128:
stdout:
stderr: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2675)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2099)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:85)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:619)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:366)
at jenkins.scm.api.SCMFileSystem$Builder.build(SCMFileSystem.java:584)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:191)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:118)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:70)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE
Make sure your credentials include the user Git:确保您的凭据包括用户 Git:
As noted in JENKINS-20879 , try with a passphrase-less private key (one which is not created encrypted).如JENKINS-20879中所述,尝试使用无密码的私钥(未加密创建的私钥)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.