bash-scripts icon indicating copy to clipboard operation
bash-scripts copied to clipboard

Cannot make git_sparse_checkout work for me

Open DrCWO opened this issue 1 year ago • 2 comments

Hello, I copied the script into my Linux system (chmod a+x was done) and for a test want to get the script itself be downloaded in /tmp

Would you please so nice to tell me how this can be achieved. I found an example how to call it here but did not work: https://stackoverflow.com/questions/60190759/how-do-i-clone-fetch-or-sparse-checkout-a-single-directory-or-a-list-of-directo/60190760#60190760

Help would be appreciated.

DrCWO avatar Aug 07 '22 17:08 DrCWO

I think you've found a bug.

It works if I do not specify a target folder:

$ git_sparse_checkout http://github.com/frgomes/bash-scripts master -- bin/git_sparse_checkout
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in /home/rgomes/tmp/bash-scripts/.git/
warning: redirecting to https://github.com/frgomes/bash-scripts/
remote: Enumerating objects: 271, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (232/232), done.
remote: Total 271 (delta 88), reused 111 (delta 33), pack-reused 0
Receiving objects: 100% (271/271), 116.62 KiB | 2.05 MiB/s, done.
Resolving deltas: 100% (88/88), done.
From http://github.com/frgomes/bash-scripts
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
branch 'master' set up to track 'origin/master'.
Already on 'master'

... but fails if I do:

$ git_sparse_checkout http://github.com/frgomes/bash-scripts master /tmp -- bin/git_sparse_checkout
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in /tmp/.git/
fatal: not in a git directory

frgomes avatar Aug 07 '22 21:08 frgomes

Thank you for validating this and show me a way it works :-)

DrCWO avatar Aug 10 '22 07:08 DrCWO