当做一个git克隆--mirror在哪里是实际的文件? [英] When doing a git clone --mirror where are the actual files?

查看:377
本文介绍了当做一个git克隆--mirror在哪里是实际的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试过了以下内容: --mirror git@github.com:user / repo.git 。

然后在 repo.git 目录中,我有以下文件结构(例如,<$ c
$ b

FETCH_HEAD branches / description info / packed-refs HEAD config hooks / objects / refs / b
$ b

所以我的问题是:我的文件在哪里!?看起来好像有一堆git相关东西,但我找不到我写的代码。我错过了一些明显的东西?



顺便说一句, git status 返回致命:运行在工作树上但是 git branch 返回分支。奇怪。

解决方案

当您 git clone --mirror 一个裸仓库,所以它不会有工作区。我更经常地使用 - mirror 来制作我工作回购的只读克隆,供其他人从中取货。



<这听起来像你可能应该忽略 - 镜像选项。



git clone 手册页


- 镜子

设置源存储库的镜像。这意味着 - 裸露。与 - bare 相比, - mirror 不仅将源的本地分支映射到目标的本地分支,它会映射所有refs(包括远程跟踪分支,注释等),并设置一个refspec配置,使得所有这些refs被目标存储库中的git远程更新覆盖。


为了清楚起见,裸露的镜像仓库确实拥有从中克隆的仓库的全部内容,但它没有可以看到这些文件的工作区。如果您从镜像克隆中克隆( git clone /path/to/local/mirror_repo.git ),您将在该新的非裸回购中获得工作树。

I have a project on github which I'd like to mirror on my server.

I've tried the following: git clone --mirror git@github.com:user/repo.git.

Then in the repo.git directory, I have the following file structure (eg, output of ls):

FETCH_HEAD branches/ description info/ packed-refs HEAD config hooks/ objects/ refs/

So my question is: where are my files!? It looks like there's a bunch of git related stuff, but I just can't find the code I've written. Am I missing something obvious?

Btw, git status returns fatal: This operation must be run in a work tree but git branch returns the branches. Weird.

解决方案

When you git clone --mirror, it produces a bare repository, so it won't have a work area. I use --mirror more often to make a read-only clone of my working repo for others to pull from.

It sounds like you probably should just omit the --mirror option.

From the git clone man page:

--mirror
Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.

To be fully clear, the bare, mirror repo does have the entire content of the repository that it was cloned from, but it does not have a work area where you can see these files. If you cloned from your mirrored clone (git clone /path/to/local/mirror_repo.git), you would get the work tree in that new, non-bare repo.

这篇关于当做一个git克隆--mirror在哪里是实际的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆