Skip to content

Instantly share code, notes, and snippets.

@radavis
Created May 30, 2017 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radavis/182ab2557fdb68dcc9ca686167123876 to your computer and use it in GitHub Desktop.
Save radavis/182ab2557fdb68dcc9ca686167123876 to your computer and use it in GitHub Desktop.

Clone a folder from a repo

Create an access token

Providing an access token allows you to avoid a user/password authentication prompt.

https://username:GITHUB_ACCESS_TOKEN@github.com/username/repo.git

Command sequence

git init
git remote add origin https://username:GITHUB_ACCESS_TOKEN@github.com/username/repo.git
git config core.sparseCheckout true
echo "path/to/folder/within/repo" >> .git/info/sparse-checkout
git pull origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment