git-shell - New repositories

前端 未结 3 912
执念已碎
执念已碎 2021-02-04 13:15

I have a server with a dedicated git user and repositories
I\'m trying to use the git-shell method to allow my devs to work on several projects.

I\'m ab

3条回答
  •  离开以前
    2021-02-04 13:48

    You can use a git-shell-commands directory to extend git-shell with custom commands, these can then be remotely executed using ssh.

    For example create ~git/git-shell-commands/newgit with this content:

    #!/bin/sh
    mkdir -p ~/$1
    cd ~/$1
    git init --bare
    

    Then chmod +x ~git/git-shell-commands/newgit to allow execution.

    To use it, run:

    ssh git@server newgit newrepo.git
    

    this is enough to create a new bare git repository, it can be cloned using:

    git clone git@server:newrepo.git
    

提交回复
热议问题