Thursday, November 17, 2022

Git: Checkout Specific Folder in a Repository

Reference: https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository

Sparse Checkout is enabled in git 1.7.0

Check out the git version:

# git version

git version 1.8.3.1

Create a folder for the repository:
# mkdir myrepo

Initiate the folder for git

# git init

Disable ssl verify if you are using self-signed certificate:

#  git config http.sslVerify "false"

Fetch all objects from Remote

#  git remote add -f origin https://bitbucket.com/scm/iu/myrepo.git

Enable sparse checkout

#  git config core.sparseCheckout true

Append the subfolder to sparse-checkout

#  echo "tcsfs/helpdesk" >> .git/info/sparse-checkout

Pull your code: 

#  git pull origin master


No comments:

Post a Comment