【问题标题】:how to move git repositories from Windows to Ubuntu server?如何将 git 存储库从 Windows 移动到 Ubuntu 服务器?
【发布时间】:2014-11-03 06:11:43
【问题描述】:

我在 Windows 系统中的 Apache http 服务器上发布了几个 git 存储库。并且文件保存在同一台计算机中。现在我想将这些 git 存储库移动到另一台计算机上,那里还有一个带有 gitweb 的 Apache http 服务器。通常我使用git clone http://username@ipaddress/git/repository_name 将这些存储库克隆到其他本地机器中。

但是当我直接将这些git仓库复制到一个git根目录时,git clone会报一个关于info/refs的错误。

有没有有效的方法来完成这项工作?谢谢。

更新:

在 Windows 7 计算机中,我将这些存储库保存在 F:/gitroot 目录中。而在httpd.conf中,相关配置如下:

    SetEnv GIT_PROJECT_ROOT F:/gitroot
    SetEnv GIT_HTTP_EXPORT_ALL
    ScriptAlias /git/ "D:/Program Files/Git/libexec/git-core/git-http-backend.exe/"

    <Directory "D:/Program Files/Git/libexec/git-core/">
    Allow From All
    </Directory>

    <Directory "F:/gitroot">
    Options All
    AllowOverride None
    Order Deny,Allow
    Deny From All
    Allow From 192.168.0.0/24
    Allow From 127.0.0.1
    Allow From All
    </Directory>

    <Location /git >
    AuthType Basic
    AuthName "Git repository"
    AuthUserFile F:/gitroot/htpasswd
    Require valid-user
    </Location>

为了清楚起见,我在F:/gitroot 中创建了一个名为test 的新目录,然后进入test 目录git init --bare,然后我们可以初始化一个新的git 存储库。然后在其他计算机上,我们可以使用git clone http://username@windows_ipaddress/git/test 克隆这个存储库进行开发。我们也可以使用git push/pull origin master 来做那些关于git 的操作来更新或修改git 仓库。

现在,我想将F:/gitroot 中的这些存储库移动到另一台操作系统为Ubuntu 12.04 的计算机上,并且还安装了apache 服务器并使用gitweb 进行配置,以便像Windows 系统中那样进行http 访问。我只是将 F:/gitroot 中的这些文件复制到 Ubuntu 计算机的 /media/backup_data/gitroot 中。这些 git 存储库的结构没有改变。

当我使用git clone http://username@ubuntu_ipaddress/git/test时,错误是:

    Cloning into 'test'...
    fatal: http://192.168.0.2/git/test/info/refs not found: did you run git update-server-info on the server?

最后,我找到了答案:我们应该更改复制目录的权限。

    sudo chown -R www-data:www-data test

那么git clone就会执行成功。

【问题讨论】:

  • 你的意思是你通常使用git clone,但这次只是做了一个文件系统的gits副本?请包含来自 Git 的完整错误消息。
  • @MagnusBäck,感谢您的回复!我已经找到原因并更新了帖子,请查收!

标签: git gitweb


【解决方案1】:

我已经在原帖的UPDATE 部分回答了这个问题。

【讨论】:

    猜你喜欢
    • 2010-12-01
    • 2011-04-23
    • 1970-01-01
    • 2011-07-05
    • 2012-07-18
    • 1970-01-01
    • 1970-01-01
    • 2021-04-18
    • 1970-01-01
    相关资源
    最近更新 更多