简体   繁体   English

无法检出git目录

[英]Unable to checkout git directory

I am trying to clone a git subdirectory 我正在尝试克隆git子目录

https://github.com/graphlab-code/graphlab/src ... I am trying to checkout only src subdirectory https://github.com/graphlab-code/graphlab/src ...我正在尝试仅签出src子目录

mkdir git-src
cd git-src
git init
git config core.sparsecheckout true
echo graphlab/src/ >> .git/info/sparse-checkout
git remote add origin https://github.com/graphlab-code/graphlab
git pull origin master

The above code doesnt seem to copy the subdirectory src . 上面的代码似乎没有复制子目录src kindly assist 请协助

You should put only the local path src , not the ' repo/src ' (' graphlab/src ') in the sparse-checkout file. 您应该仅将本地路径src放置在sparse-checkout文件中,而不要放置' repo/src '(' graphlab/src ')。

echo src/*> .git/info/sparse-checkout

That is because git read-tree reads local path from within the repo, defined in the skip-worktree bitmap $GIT_DIR/info/sparse-checkout . 这是因为git read-tree从仓库中读取本地路径,该仓库是在skip-worktree位图$GIT_DIR/info/sparse-checkout

I managed to copy src only with the src/* syntax. 我设法仅使用src/*语法复制src。

All other attempts left me with: 所有其他尝试使我拥有:

error: Sparse checkout leaves no entry on working directory

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM