I want to deploy jenkins on a remote server, when I push the code to the repository, Jenkins builds automatically.
I have uploaded ssh to github and can connect using terminal.
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.
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.
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:
As noted in JENKINS-20879 , try with a passphrase-less private key (one which is not created encrypted).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.