将Git存储库备份转换为本地存储库。

huangapple go评论54阅读模式
英文:

convert git dump into local repo

问题

我有一个最初从GitHub导出的git dump。我不知道他们是如何进行导出的,但我已经提取了zip文件,文件的结构如下。

从那个文件夹运行git status返回:
在分支main上没有要提交的内容,工作树干净

尝试并没有帮助:
git clone exported_dir/ dst_dir/

我希望在那个仓库中看到一些C#代码文件

将Git存储库备份转换为本地存储库。

如何将它们转换为实际的资源,保留所有分支、历史记录、日志等?

英文:

I got a git dump which was originally exported from GitHub.
I can't know how they made the export but I have extracted the zip file and the structure of the files are as below.

git status from that folder returns with:
On branch main nothing to commit, working tree clean

Tried and didn't help:
git clone exported_dir/ dst_dir/

I do expect to see in that repo some C# code files

将Git存储库备份转换为本地存储库。

How can I convert them to the actual resources keeping all branches, history, logs, etc?

答案1

得分: 0

看起来你收到了一个混合了裸仓库和非裸仓库的内容。通常,如果你有像HEADconfigpacked-refs这样的文件,它已经是一个仓库(没有工作树)。

你可以尝试从这个目录本地使用git clone命令来"解裸"这个仓库:

git clone unzipped-dir/ somewhere-else/
英文:

It seems you received a mixture of a bare and non-bare repository. Normally if you have files like HEAD, config, packed-refs it's already a repository (without a working tree).

You can try git clone locally from this directory to "un-bare" the repo:

git clone unzipped-dir/ somewhere-else/

huangapple
  • 本文由 发表于 2023年7月3日 13:40:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76602087.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定