Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Git SCM with credentials #50

Open
adityacs opened this issue Nov 9, 2016 · 13 comments
Open

Configure Git SCM with credentials #50

adityacs opened this issue Nov 9, 2016 · 13 comments

Comments

@adityacs
Copy link

adityacs commented Nov 9, 2016

How can I configure Git SCM with credentials. I don't see any fields for configuring credentials.
I have to access Git with https

Thanks

@bmannix
Copy link

bmannix commented Dec 16, 2016

You could use Basic Auth.

https://<user>:<pass>@<url>

In the case of GitHub, you could also use a token:

https://<token>@github.com/owner/repo.git

@roydekleijn
Copy link

your suggestion doesn't work for me :(

@timmjd
Copy link

timmjd commented Aug 8, 2017

How's about making use of the default way: Use the credential storage of Jenkins?

@yuchaoran2011
Copy link

I have the credentials stored in Jenkins. My Jenkins jobs can access Github repos and build them without problems. But SCM Sync Plugin still doesn't work. Got the following error. Has anyone got it to work? Some help is greatly appreciated!

Dec 01, 2017 10:10:57 PM SEVERE hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles

[checkinFiles] Problem during SCM commit :
*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'jenkins@ip-10-11-0-97.(none)')

@gbarilska
Copy link

Hi, I have the same problem- the jobs are configured with Jenkins credentials and it's working well, but in Jenkins configuration for SCM sync configuration there is not an option to add the credentials, so I'm receiving the same error. Did you have any success with this issue?

@gbarilska
Copy link

gbarilska commented Feb 6, 2018

This is how it looks the Job configuration:
job config
-> It provides a place for setting credentials;


And here is the Manage Jenkins -> Configure System:
jenkins config
-> It's not provided a place to add credentials for SCM sync Plugin here so it leads to
"SEVERE: svn: E200015: E200015: ISVNAuthentication provider did not provide credentials; HTTP authorization cancelled."

Can anyone help with configuring SCM authenticatuion?

@monkpit
Copy link

monkpit commented Mar 27, 2018

I have the same issue as @gbarilska - in the SCM Sync Configuration I have no option to select credentials from Jenkins, so SCM sync fails.

@ghost
Copy link

ghost commented Jun 11, 2018

+1, same issue here
I have tried every syntax to pass the login/password into the URL, but it doesn't work
Also no way to use the native credentials system.

EDIT: I solved the problem, it was simply that the repository wasn't configured to accept these credentials... stupid mistake. So mine was working out of the box, all i had to do was restart jenkins.

PS: jenkins log file:

Jun 11, 2018 9:28:09 AM INFO hudson.plugins.scm_sync_configuration.SCMManipulator scmConfigurationSettledUp
Creating scmRepository connection data ..
Jun 11, 2018 9:28:09 AM INFO hudson.plugins.scm_sync_configuration.scms.SCM getConfiguredRepository
Creating SCM repository object for url : scm:git:https://:@github.com/nbmgroupe/jenkins_home.git
Jun 11, 2018 9:28:09 AM INFO hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness initializeRepository
Initializing SCM repository for scm-sync-configuration plugin ...
Jun 11, 2018 9:28:09 AM INFO hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness cleanChekoutScmDirectory
Deleting old checkout SCM directory ...
Jun 11, 2018 9:28:09 AM INFO hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness initializeRepository
Directory [/var/jenkins_home/scm-sync-configuration/checkoutConfiguration] created !
Jun 11, 2018 9:28:10 AM INFO hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness initializeRepository
SCM repository initialization done.
Jun 11, 2018 9:28:10 AM WARNING hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin setTransaction
Existing threaded transaction will be overriden !
Jun 11, 2018 9:28:11 AM SEVERE hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
[checkinFiles] Problem during SCM commit : remote: Permission to nbmgroupe/jenkins_home.git denied to .
fatal: unable to access 'https://:@github.com/nbmgroupe/jenkins_home.git/': The requested URL returned error: 403

Jun 11, 2018 9:28:11 AM SEVERE hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness processCommitsQueue
Error while processing commit queue : Error while checking in file to scm repository
Jun 11, 2018 9:28:12 AM SEVERE hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
[checkinFiles] Problem during SCM commit : remote: Permission to nbmgroupe/jenkins_home.git denied to .
fatal: unable to access 'https://:@github.com/nbmgroupe/jenkins_home.git/': The requested URL returned error: 403

Jun 11, 2018 9:28:12 AM SEVERE hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness processCommitsQueue
Error while processing commit queue : Error while checking in file to scm repository

@smurfy1
Copy link

smurfy1 commented Jun 13, 2018

+1 same issue, SCM plugin won't authenticate

Creating scmRepository connection data ..
Jun 13, 2018 11:26:28 AM INFO hudson.plugins.scm_sync_configuration.scms.ScmSyncSubversionSCM extractScmCredentials
Extracting SVN Credentials for url : http://xxx.xxx.xxx.xxx/jenkins/trunk
Jun 13, 2018 11:26:28 AM WARNING org.eclipse.jetty.server.handler.ContextHandler$Context log
Error while serving http://jenkins.xxx.xxx.xxx /configSubmit
java.lang.NullPointerException
at hudson.plugins.scm_sync_configuration.scms.ScmSyncSubversionSCM.extractScmCredentials(ScmSyncSubversionSCM.java:60)
at hudson.plugins.scm_sync_configuration.scms.SCM.getConfiguredRepository(SCM.java:66)
at hudson.plugins.scm_sync_configuration.SCMManipulator.scmConfigurationSettledUp(SCMManipulator.java:57)
at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.initializeRepository(ScmSyncConfigurationBusiness.java:72)
at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin.configure(ScmSyncConfigurationPlugin.java:234)
at jenkins.model.GlobalPluginConfiguration.configure(GlobalPluginConfiguration.java:27)
at jenkins.model.Jenkins.configureDescriptor(Jenkins.java:3707)
at jenkins.model.Jenkins.doConfigSubmit(Jenkins.java:3671)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
Caused: java.lang.reflect.InvocationTargetException
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:347)
at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52)
at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter$1.call(ScmSyncConfigurationFilter.java:49)
at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter$1.call(ScmSyncConfigurationFilter.java:44)
at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationDataProvider.provideRequestDuring(ScmSyncConfigurationDataProvider.java:106)
at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter.doFilter(ScmSyncConfigurationFilter.java:44)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:95)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:85)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

@bsnareshorc
Copy link

Since using the basic auth with username:password in the repo url is not an option for us, we are thinking of extending this plugin to make use of the Jenkins Credentials Plugin to authenticate with our git repo. Has anyone already tried something like this?

@joshmullis
Copy link

Definitely need this. Without utilizing the built-in credentials store, I'm pretty sure you will be inadvertently uploading your auth token into git. :|

@ntelisil
Copy link

ntelisil commented Aug 20, 2018

Yet another +1.
You should be able to provide the credentials (keys) like in SCM - job configuration.
Otherwise you would have to store the private key in the disk under ~/.ssh/... which is not always the best option in terms of security.

@SeanEire
Copy link

+1 this also. Would be great to reuse the same built in credentials approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests