Created
November 21, 2008 19:36
-
-
Save shanesveller/27584 to your computer and use it in GitHub Desktop.
Sake task to remotely create a bare git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Create a new git repository at $GITUSER@$HOST:$REPO/' | |
task 'git:repo:new' do | |
user = (ENV["GITUSER"] or "git") | |
host = ENV["HOST"] | |
repo = ENV["REPO"] | |
system("ssh root@#{host} 'cd /home/git/ && mkdir -p #{repo} && cd #{repo} && git --bare init && chown -R git:git /home/git/#{repo}'") | |
end | |
# Must have root access, repo owner defaults to 'git' | |
# Using root user is to account for my preference to use git-shell as the shell on my 'git' user accounts | |
# Example usage: | |
# sake git:repo:new GITUSER=git HOST=git.mywebsite.com REPO=sakefiles | |
# Would create a new git repo available at [email protected]:sakefiles/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment