0

I have couple of branches, say

  • branch1 branch2 branch3

Here, current branch is branch1, i want to perform the following operation git checkout branch2 and then git pull origin branch2 using Jenkins.

Mridul
  • 258
  • 3
  • 9
  • Those commands are executed in a shell context, so: https://stackoverflow.com/questions/21276351/how-can-i-execute-shell-script-in-jenkinsfile – alex Sep 16 '19 at 14:03
  • But, while taking pull on git branch it will ask for git user credentials, how to automate that part? – Mridul Sep 17 '19 at 12:22
  • Use `git config` to store credentials: https://stackoverflow.com/questions/35942754/how-to-save-username-and-password-in-git – alex Sep 17 '19 at 14:10
  • There are multiple git users all have different repository access, we can't configure all git credentials using git config in servers. – Mridul Sep 18 '19 at 04:32
  • Are you saying that all of your developers all work on the same, single development machine? – alex Sep 18 '19 at 13:10
  • yes, in the same development machine. – Mridul Sep 19 '19 at 05:40
  • Each user can set up an environmental variable to store their user.name and user.email: https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables – alex Sep 19 '19 at 13:10

0 Answers0