Re: Pushing a git repository to a new server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 11, 2013 at 7:45 AM, Konstantin Khomoutov
<kostix+git@xxxxxxxxx> wrote:
[...]
> OK, here's the sketch.
> On the server, in the home directory of your "git" user, you create a
> wrapper around git-receive-pack, like this:
>
> # mkdir ~git/git-shell-commands
> # cat >~git/git-shell-commands/git-receive-new-repo
> #!/bin/sh
>
> set -e -u
>
> if [ $# -ne 1 ]; then
>         echo 'Missing required argument: <directory>' >&2
>         exit 1
> fi
>
> mkdir "$1" && git init --quiet --bare "$1" && git-receive-pack "$1"
> ^D
> # chmod +x $_
>
> Then, on the client side, to push a new repo, you just do
>
> $ git push --receive-pack=git-receive-new-repo --all git@server:repo.git
>
> This will make `git push` to spawn not just `git receive-pack <dir>` as
> it usually does but your wrapper, which would first create and
> initialize a bare repository and then spawn `git receive-pack` on it
> which would then communicate with the client side and receive
> everything from it.
>
> You could then create a client-side wrapper script or a Git alias for
> such "creative pushing", like this:
>
> $ git config --add --global alias.push-new-repo \
>   'push --receive-pack=git-receive-new-repo --all'
>
> So the whole client call is now reduced to
>
> $ git push-new-repo git@server:repo.git

Thanks, that's what I was going for.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]