Search code examples
gitgitweb

how to move git repositories from Windows to Ubuntu server?


I have published several git repositories in an Apache http server located in a Windows system. And the files are saved in the same computer. Now I want to move these git repositories into another computer, where there is also an Apache http server with gitweb. Generally I use git clone http://username@ipaddress/git/repository_name to clone these repositories into other local machines.

But when I directly copied these git repositories into one git root directory, the git clone will report one error about info/refs.

Is there any efficient ways to do this work? Thank you.

UPDATED:

In the Windows 7 computer, I save these repositories in F:/gitroot directory. And in the httpd.conf, the related configuration is as follows:

    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>

And for clarity, I make a new directory named test in F:/gitroot, then go into the test directory, git init --bare, then we could initialize a new git repository. Then in other computers, we could use git clone http://username@windows_ipaddress/git/test to clone this repository to develop. Also we could use git push/pull origin master to do those operations about git to update or modifiy the git repository.

Now, I want to move these repositories in F:/gitroot into another computer where the operating system is Ubuntu 12.04, and also the apache server is installed and configured with gitweb for http access like that in the Windows system. I just copy those files in F:/gitroot into /media/backup_data/gitroot the Ubuntu computer. The structure of these git repositories is not changed.

When I use git clone http://username@ubuntu_ipaddress/git/test, the error is :

    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?

Finally, I have found the answer: we should change the privileges of the copied directory.

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

Then, the git clone will be executed successfully.


Solution

  • I've answered this question in the Section UPDATE of the original post.