Dmitry R
Dmitry R

Reputation: 3176

Git push in Jenkins

I'm using Jenkins multiple scm plugin to pull code from multiple git repos to multiple subfolders:

${WORKSPACE}/**repoa**
${WORKSPACE}/**repob**

After part of the build steps executed it generates for me configuration file in:

${WORKSPACE}/**repob**/configfile${BUILD_NUMBER}.json

I would like to commit and push this file to repob master

However when I'm trying to run the following:

cd ${WORKSPACE}/repob
git add .
git commit -a -m "${BUILD_NUMBER}"
git push

The git push fails due to missing credentials for the repo

I tried to use git publisher however it seems that it's not playing well with multiple scm configuration

My repo is bitbucket and I'm working with it over https

Any ideas would be appreciated

Upvotes: 0

Views: 2161

Answers (1)

Alim Özdemir
Alim Özdemir

Reputation: 2634

The easiest/safest compromise would be probably:

On jenkins' configure page set the Git plugin entry for

Global Config user.name Value

and have your remote repos defined with ssh (instead of https), and on those machines have the ssh-key of jenkins configured as authorized key, then only username needs to be defined.

Upvotes: 0

Related Questions