power_settings_new
We are using Git as our SCM. I would like to clone or checkout specific directory, not the whole project in Git. Can you guide me on how to checkout or clone specific directory from Git repository via command line and Jenkins? What plugin should I be using with Jenkins?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

2 Answers

answered by (151 points)
selected by
0 votes
 
Best answer

You can not really clone specific directory from git repository, you need to download whole repository. But, you can checkout specific folder or file from your commit or branch.

Eg command,

git checkout branch_or_version -- path/file

To checkout specific file from the branch.

git checkout HEAD -- main.c

to checkout specific folder from the commit.

git checkout e5224c883a490f11c1f1cb2b2f2aae9d4ce17ac9 /path/to/directory

To checkout specific folder or file on Jenkins, you can utilize MSEM Plugin. In that you can define your directory or file into sparse checkout field.

commented by (-9 points)
Hiiii... How are you all,

Please anyone help me on this...Actually I am new to jenkins...I am trying to download the specific folder from my Git hub repository .Actual Repository URL is :  ssh://[email protected]/vcs00p10/repo/wincaredev/WINCareCRM-Account-Functions.git


While i am trying to new cloning or new checkout from Source Tree i used to pass the aboove url and try to cloning successfully.

once it is successfully cloning it will be download the complete code under  C:\g-acc\apps\WINbizCRM-CI-SEL\Code  this directory.

I am trying to download only "WINbizCRM-CI-SEL" folder from repository in jenkin.

what i need to chnage or how to download only the specific folder from git in jenkin.

For your information under jenkins -->configuration--->Sourcecode management--->i disabled the additional behaviours--->choose only for the "Checkout to a subdirectory" and given the Local subdirectory for repo as "WINbizCRM-CI-SEL". But its download all the repository under WINbizCRM-CI-SEL this folder.

It just create the folder and download again complte repository as like "C:\g-acc\apps\WINbizCRM-CI-SEL\Code" ...

I just want to download only "\WINbizCRM-CI-SEL\Code"

I hope now you understand what i am looking for .....Please help me on this



Read more: https://softwaretestingboard.com/qna/1791/how-clone-checkout-specific-directory-command-line-jenkins#ixzz5V2OnYNb1
answered by (-9 points)
–1 vote

Hiiii... How are you all,

Please anyone help me on this...Actually I am new to jenkins...I am trying to download the specific folder from my Git hub repository .Actual Repository URL is :  ssh://[email protected]/vcs00p10/repo/wincaredev/WINCareCRM-Account-Functions.git


While i am trying to new cloning or new checkout from Source Tree i used to pass the aboove url and try to cloning successfully.

once it is successfully cloning it will be download the complete code under  C:\g-acc\apps\WINbizCRM-CI-SEL\Code  this directory.

I am trying to download only "WINbizCRM-CI-SEL" folder from repository in jenkin.

what i need to chnage or how to download only the specific folder from git in jenkin.

For your information under jenkins -->configuration--->Sourcecode management--->i disabled the additional behaviours--->choose only for the "Checkout to a subdirectory" and given the Local subdirectory for repo as "WINbizCRM-CI-SEL". But its download all the repository under WINbizCRM-CI-SEL this folder.

It just create the folder and download again complte repository as like "C:\g-acc\apps\WINbizCRM-CI-SEL\Code" ...

I just want to download only "\WINbizCRM-CI-SEL\Code"

I hope now you understand what i am looking for .....Please help me on this

commented by (142 points)
Hi Faizazn,

What you have posted is a question and not a solution.

I suggest you go to ask page and post your question to get solutions.

https://softwaretestingboard.com/qna/ask
add
...