Git Plugin doesn't pull from repo .git url

281 views
Skip to first unread message

jbr...@snapapp.com

unread,
Dec 20, 2016, 3:52:30 PM12/20/16
to Jenkins Users
Hi all,

I'm running an issue when I try to use the repository URL (the one used for `git clone`) of a private project in the Repository URL field:

> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url g...@github.com:foo/bar.git # timeout=10
Fetching upstream changes from g...@github.com:foo/bar.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > git fetch --tags --progress g...@github.com:foo/bar.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from g...@github.com:foo/bar.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
	at hudson.scm.SCM.checkout(SCM.java:495)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	at hudson.model.Run.execute(Run.java:1720)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress g...@github.com:foo/bar.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

If I use the project URL- that is, https://github.com/foo/bar- it's able to see it just fine. Is this a documentation issue, or am I supposed to be using the *.git repo? If so, what am I doing wrong above? I know I've got my credentials set up correctly.

Versions:
Jenkins ver. 2.19.4
Git Plugin: 3.0.1

Thanks!
Jack

Indra Gunawan (ingunawa)

unread,
Dec 20, 2016, 4:15:12 PM12/20/16
to jenkins...@googlegroups.com

Have you added the SSH public key of the user used for cloning the github repo on Jenkins node/agent using git plugin?

Have you created the Jenkins Credential using SSH private key for the user on Jenkins?  Have you set the git plugin’s Credential drop-down item to this new credential that you added to Jenkins?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c56bf7af-f20d-4e41-9c40-2b950ea6fafa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jack Brooks

unread,
Dec 21, 2016, 4:34:17 PM12/21/16
to jenkins...@googlegroups.com
Hi Indra,

To be clear, when you say, "Have you added the SSH public key of the user used for cloning the github repo on Jenkins node/agent using git plugin?" do you mean adding the public key of the github user to ~/.ssh on the agent as a discrete file, or in authorized_users? Sorry, I'm not certain what we're talking about here.

Thanks!
Jack

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/Yvnxcyida-g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/092F8E05-9071-414B-A5AA-E9BF5A0BBB9A%40cisco.com.

Jack Brooks

unread,
Dec 21, 2016, 4:59:12 PM12/21/16
to jenkins...@googlegroups.com
Aha! I must have gotten something wrong in the rest of the steps, because using a fresh new key I was able to get this working. Sorry for the dumb user error, and thanks for the help!

Jack
Reply all
Reply to author
Forward
0 new messages