Skip to content

Instantly share code, notes, and snippets.

@abstraktor
Created November 25, 2011 16:59
Show Gist options
  • Save abstraktor/1393972 to your computer and use it in GitHub Desktop.
Save abstraktor/1393972 to your computer and use it in GitHub Desktop.
create an hosted git repo without server (dirty!)
#!/usr/bin/env ruby
# this will create a new repo
# to be continued
abort "usage: create-repo <name>\nthe group git-<name> should exist" if ARGV.count != 1
dirname = "%s.git" % ARGV[0]
groupname="git-%s" % ARGV[0]
domain = "timum.de"
Dir.chdir "/var/git" do
system "mkdir #{dirname}" and
system "cp -r preset/.git #{dirname}/.git" and
#system "chown :#{groupname} -R #{dirname}" and
system "chmod g+rws -R #{dirname}" and
puts "now execute this:\n git clone ssh://%s@%s/var/git/%s" % [%x[whoami].strip, domain, dirname]
end
#!/bin/bash
# setup / reinit of this installation:
# sudo chmod g+rwxs * .* -R
# sudo addgroup git-timum-prototype
# # for all users that should have (write) access to this repo, do
# sudo adduser somebody git-timum-prototype
# sudo chown :git-timum-prototype * .* -R
cd ..
#thats dirty:
chmod ug+rwx . -R 2> /dev/null
echo "resetting working tree hard in `pwd`"
#whatever
#so is this:
unset GIT_DIR
git reset --hard
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
[receive]
denyCurrentBranch = ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment