Re: Pull over git uses the wrong path after upgrade

34 views
Skip to first unread message

lars...@gmail.com

unread,
May 23, 2013, 10:42:44 AM5/23/13
to gito...@googlegroups.com
On Thursday, May 23, 2013 2:23:55 PM UTC+2, lars...@gmail.com wrote:
This seems to have to do with the changed directory layout in gitorious/repositories; the old repos have a name apparently based on SHA-1 (e.g. 429/e18/bb2375275f8ea135fb6cdf77b6476375d5.git), while the new ones follow a project/reponame format. Apparently, when using the git:// protocol, the old style names are used, since I get log messages in /var/log/messages of the form

    May 23 14:21:35 github git-daemon[16998]: Request upload-pack for '/project/reponame.git'
    May 23 14:21:35 github git-daemon[16998]: '/var/www/gitorious/repositories/project/reponame.git' does not appear to be a git repository
Is there an easy way to fix this? E.g., can I systematically symlink the new names to the old ones?

Just in case anyone else has this problem: I did a

    select slug, name, hashed_path from repositories, projects where repositories.project_id = projects.id;

on the gitorious_production table in MySQL, then wrote a script that effectively does

    ln -s ../hashed_path.git slug/name.git

for each result of that query in /var/www/gitorious/repositories. This seems to work.

Marius Mårnes Mathiesen

unread,
May 24, 2013, 3:00:20 AM5/24/13
to gito...@googlegroups.com

lars...@gmail.com writes:

> Dear all,
>
> I'm experiencing a strange problem after upgrading an old (2011) Gitorious
> installation to a new one (installed as per getgitorious.com).
>
> I managed to transfer all of my repositories using some rsync magic, and
> now cloning, pushing and pulling over SSH work fine, but using the git://
> protocol only works for new repos.
>
> This seems to have to do with the changed directory layout in
> gitorious/repositories; the old repos have a name apparently based on SHA-1
> (e.g. 429/e18/bb2375275f8ea135fb6cdf77b6476375d5.git), while the new ones
> follow a project/reponame format. Apparently, when using the git://
> protocol, the old style names are used, since I get log messages in
> /var/log/messages of the form
>
> May 23 14:21:35 github git-daemon[16998]: Request upload-pack for
> '/project/reponame.git'
> May 23 14:21:35 github git-daemon[16998]:
> '/var/www/gitorious/repositories/project/reponame.git' does not appear to
> be a git repository
>
> while my local Git client just says
>
> fatal: The remote end hung up unexpectedly
>
> Is there an easy way to fix this? E.g., can I systematically symlink the
> new names to the old ones?

Lars,
The path to the repository will have to be resolved from the database
based on the incoming Git URL. The common way to resolve this is to use
a proxy server listening on port 9418 (the public git:// port) which
resolves the URL and proxies the connection to a backend git-daemon
process.

Have a look in the script/git-proxy file in your installation. It
contains these instructions:

# Alternative to script/git-daemon which uses the native git-daemon
# instead. Run this script on port 9418 and it will handle all git://
# access. As the name implies, this script simply acts as a proxy, translating
# the git urls presented in the web view to the hashed paths on the file system
# (which the native git-daemon then handles).
#
# Using script/git-proxy with git-daemon as an alternative to script/git-daemon
# has the advantage of being more stable, but requires two daemons instead of
# one, which complicates matters slightly.
#
# Running it
#
# First of all, make sure the native git-daemon is running. This example uses
# port 9400, but you can use any port of your liking:
#
# $ git daemon --listen=0.0.0.0 --port=9400 --syslog --export-all \
# --pid-file=/path/to/gitorious/tmp/pids/git-daemon-9400.pid \
# --base-path=/path/to/gitorious/repositories --verbose --reuseaddr \
# /path/to/gitorious/repositories
#
# NOTE: If you change the port for git-daemon, make sure to update
# config/git-proxymachine.rb to reflect the change (:remote, l40).
#
# Then run the git-proxy script:
#
# $ bundle exec /path/to/gitorious/script/git-proxy
#
# Test by issuing:
#
# $ git ls-remote git://gitorious.local/some/repo.git


Cheers,
- Marius

lars...@gmail.com

unread,
May 24, 2013, 9:30:26 AM5/24/13
to gito...@googlegroups.com
On Friday, May 24, 2013 9:00:20 AM UTC+2, Marius Mårnes Mathiesen wrote:
The path to the repository will have to be resolved from the database
based on the incoming Git URL. The common way to resolve this is to use
a proxy server listening on port 9418 (the public git:// port) which
resolves the URL and proxies the connection to a backend git-daemon
process.

Have a look in the script/git-proxy file in your installation. It
contains these instructions:

Thanks, that looks like a much more principled solution. I'm a bit surprised that this isn't done by default, is there a reason for that?

Marius Mårnes Mathiesen

unread,
May 24, 2013, 9:40:46 AM5/24/13
to gito...@googlegroups.com
IIRC this is how the community edition will set it up, which is probably
as close to a default setup there is.


Cheers,
- Marius
Reply all
Reply to author
Forward
0 new messages