shanesveller (owner)

Revisions

gist: 27584 Download_button fork
public
Description:
Sake task to remotely create a bare git repo
Public Clone URL: git://gist.github.com/27584.git
Embed All Files: show embed
remote-git-repo.sake.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 git@git.mywebsite.com:sakefiles/