0

I have a folder inside D:/TestFolder/ Now I need to git pull inside TestFolder using Jenkins every time I trigger a job. How is it possible?

Can anyone guide me on Jenkins git pull in a particular folder?

Mia
  • 448
  • 8
  • 22
  • Does this answer your question? [How do you clone a Git repository into a specific folder?](https://stackoverflow.com/questions/651038/how-do-you-clone-a-git-repository-into-a-specific-folder) – Aditya Jalkhare Jul 27 '20 at 08:07
  • No, I am asking how can I Do in Jenkins Application. I think that is not helping me. sorry! – Mia Jul 27 '20 at 10:48

1 Answers1

1

git plugins for Jenkins come with that option -

If you are using Jenkins freestyle job, enter image description here

If you are using Jenkins scripted pipeline , It will be like

node() {
  stage('checkout') {
     checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'sub_folder']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'credentialId', url: 'http://repourl.net/x.git']]])

  }
}
Samit Kumar Patel
  • 1,932
  • 1
  • 13
  • 20