Git Clone: Just the files, please?

后端 未结 8 663
北海茫月
北海茫月 2021-01-30 00:25

I want to clone a GIT repo and NOT end up with a .git directory. In other words I just want the files. Is there a way to do this?

git clone --no-chec

相关标签:
8条回答
  • 2021-01-30 01:12
    git --work-tree=/tmp/files_without_dot_git clone --depth=1 \
      https://git.yourgit.your.com/myawesomerepo.git \
      /tmp/deleteme_contents_of_dot_git
    

    Both the directories in /tmp are created on the fly. No need to pre-create these.

    0 讨论(0)
  • 2021-01-30 01:20

    Why not perform a clone and then delete the .git directory so that you just have a bare working copy?

    Edit: Or in fact why use clone at all? It's a bit confusing when you say that you want a git repo but without a .git directory. If you mean that you just want a copy of some state of the tree then why not do cp -R in the shell instead of the git clone and then delete the .git afterwards.

    0 讨论(0)
提交回复
热议问题