如何使用Git * INTO *裸仓库进行抽取/提取? [英] How do I pull/fetch with Git *INTO* a bare repository?

查看:157
本文介绍了如何使用Git * INTO *裸仓库进行抽取/提取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个工具,将我所有的存储库从 Bitbucket (支持Git和Mercurial)备份到我的本地机器。



它已经适用于Mercurial,我这样做:


  • 在本地机器上创建一个没有工作副本的新的空存储库

    (类似于 bare Git存储库)

  • 从远程存储库拉入本地空存储库



现在我正在尝试使用Git 。



已经找到了,我不能直接将到裸仓库,我应该使用 fetch

所以我试了一下:

  C:\\ \\ test> git fetch https://github.com/SamSaffron/dapper-dot-net.git 
remote:计数对象:1255,完成。
remote:压缩对象:100%(1178/1178),完成。
remote:共计1255(delta 593),重用717(delta 56)
接收对象:100%(1255/1255),13.66 MiB | 706 KiB / s,完成。
解决三角洲问题:完成100%(593/593)。
从https://github.com/SamSaffron/dapper-dot-net
*分支HEAD - > FETCH_HEAD

显然Git 没有获取某些内容,但本地存储库在那么。

git log fatal:bad default revision'HEAD') p>

我做错了什么?

免责声明:

我只有非常非常基本的Git知识(我通常使用Mercurial)。

我使用Windows,如果这很重要的话。

解决方案

试试

  git fetch https://github.com/SamSaffron/dapper-dot- net.git master:master 


I'm writing a tool to backup all my repositories from Bitbucket (which supports Git and Mercurial) to my local machine.

It already works for Mercurial, where I do it like this:

  • create a new empty repository without a working copy on the local machine
    (the same like a bare Git repository)
  • pull from the remote repository into the local empty repository

Now I'm trying to do the same with Git.

I already found out that I can't directly pull to a bare repository and that I should use fetch instead.

So I tried it:

C:\test>git fetch https://github.com/SamSaffron/dapper-dot-net.git
remote: Counting objects: 1255, done.
remote: Compressing objects: 100% (1178/1178), done.
remote: Total 1255 (delta 593), reused 717 (delta 56)
Receiving objects: 100% (1255/1255), 13.66 MiB | 706 KiB/s, done.
Resolving deltas: 100% (593/593), done.
From https://github.com/SamSaffron/dapper-dot-net
 * branch            HEAD       -> FETCH_HEAD

Obviously Git did fetch something, but the local repository is empty after that.
(git log says fatal: bad default revision 'HEAD')

What am I doing wrong?

Disclaimer:
I have only very, very basic Git knowledge (I usually use Mercurial).
And I'm using Windows, if that matters.

解决方案

Try

git fetch https://github.com/SamSaffron/dapper-dot-net.git master:master

这篇关于如何使用Git * INTO *裸仓库进行抽取/提取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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