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 about to change the shell of my git
user to git-shell
If I do that, I won't be able to connect with a standard shell anymore (that's the idea).
Question: So how will I create new repositories ?
Will I have each time to connect with a sudoer and create the repo then chown it ?
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