From: Sitaram Chamarty <sitaramc@gmail.com>
To: Jiang Xin <worldhello.net@gmail.com>, Git List <git@vger.kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>, Jamey Sharp <jamey@minilop.net>
Subject: Re: Access different NAMESPACE of remote repo from client side
Date: Fri, 15 Nov 2013 20:17:44 +0530 [thread overview]
Message-ID: <52863410.9090508@gmail.com> (raw)
In-Reply-To: <52862EEE.8010800@gmail.com>
On 11/15/2013 07:55 PM, Sitaram Chamarty wrote:
> On 11/15/2013 01:49 PM, Jiang Xin wrote:
>> GIT_NAMESPACE is designed to be used mainly on the server side, that
>> the server can serve multiple git repositories while share one single
>> repository storage using different GIT_NAMESPACE settings.
>>
>> Since we know that one remote repository hosts multiple namespaces,
>> can we handle different namespaces in one local repository? Or can
>> we access the proper namespace of the remote repository without
>> complicated server settings?
>>
>> At least there are three solutions for ssh protocol: pass namespace
>> through environment, pass namespace in URL, or pass namespace from
>> the proper settings of remote.<name>.receivepack and
>> remote.<name>.uploadpack.
>>
>> Solution 1: passing the namespace through environment.
>>
>> 1. Set '/etc/sshd_config' in the server side as the following,
>> so that the ssh server can accept GIT_NAMESPACE environment.
>>
>> AcceptEnv LANG LC_* GIT_NAMESPACE
>>
>> 2. In the client side, When connect to ssh server, must send the
>> GIT_NAMESPACE environment. This can be done with a remote-ext
>> url:
>>
>> $ git remote add foo \
>> 'ext::ssh -o SendEnv=GIT_NAMESPACE git@server %S 'path/to/repo.git'
>>
>> Then the remote "foo" is GIT_NAMESPACE aware, but when operate on
>> this remote, must provide proper "--namespace" option.
>>
>> $ git --namespace=foo push foo master
>> $ git --namespace=foo fetch foo
>> $ git --namespace=foo ls-remote foo
>> $ git --namespace=foo remote prune foo
>> $ git --namespace=foo archive --remote foo HEAD
>>
>> But provide a "--namespace" option is error-prone, but we may invent
>> "remote.<name>.namespace" or something to set GIT_NAMESPACE
>> automatically when push to or fetch from remote server.
>>
>> Solution 2: passing the namespace in URL.
>>
>> Again use remote-ext style URL to access remote repository:
>>
>> $ git remote add foo \
>> 'ext::ssh git@server git --namespace foo %s path/to/repo.git'
>>
>> $ git remote add bar \
>> 'ext::ssh git@server git --namespace bar %s path/to/repo.git'
>>
>> But if the remote server use a limit shell (such as git-shell or
>> gitolite), the above URLs won't work. This is because these git
>> specific shell (git-shell or gitolite) do not like options.
>>
>> Solution 3: use custom receivepack and uploadpack. e.g.
>>
>> [remote "foo"]
>> url = ssh://git@server/path/to/repo.git
>> receivepack = git --namespace foo receive-pack
>> uploadpack = git --namespace foo upload-pack
>> fetch = +refs/heads/*:refs/remotes/foo/*
>>
>> [remote "bar"]
>> url = ssh://git@server/path/to/repo.git
>> receivepack = git --namespace bar receive-pack
>> uploadpack = git --namespace bar upload-pack
>> fetch = +refs/heads/*:refs/remotes/foo/*
>>
>> Just like solution 2, these settings won't work without a patched
>> git-shell or gitolite.
>
> Gitolite has a namespaces branch that handles namespaces as described in
> http://gitolite.com/gitolite/namespaces.html
>
> Briefly, it recognises that you can have a "main" repo off of which
> several developer might want to hang their logical repos.
>
> It also recognises that the actual names of the logical repos will
> follow some pattern that may include the name of the developer also, and
> provides a way to derive the name of the physical repo from the logical
> one.
>
> There is an example or two in that link.
I should add that the Gitolite model is: the user doesn't need to know
about namespaces, because namespaces are just things that the server
admin is setting up for his own reasons...
...typically because he anticipates several dozens of people cloning the
same repo into their namespace and so he expects to save a lot of disk
doing this).
So in this model we don't really need anything on the client side.
next prev parent reply other threads:[~2013-11-15 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 8:19 Access different NAMESPACE of remote repo from client side Jiang Xin
2013-11-15 9:49 ` [PATCH] shell: allow git command with --namespace option Jiang Xin
2013-11-15 14:25 ` Access different NAMESPACE of remote repo from client side Sitaram Chamarty
2013-11-15 14:47 ` Sitaram Chamarty [this message]
2013-11-16 8:00 ` Jiang Xin
2013-11-16 9:13 ` Sitaram Chamarty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52863410.9090508@gmail.com \
--to=sitaramc@gmail.com \
--cc=git@vger.kernel.org \
--cc=jamey@minilop.net \
--cc=josh@joshtriplett.org \
--cc=worldhello.net@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).