need some help with git

Due to language barrier, I will start by explaining what do I want:

I Want to use git as my server config file revision control.
I'm using zfs.
I will have few repositories, 1 for host, and 1 for each jail.
I want to keep these repositories on separate zfs partition /git

when I commit some changes I want to be able to push them to /git/hostname.git repository.

And this is the part I fail. I tried few different methods creating git repositories and they all failed with this
Code:
$ git push
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 341 bytes, done.
Total 4 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To /git/root.bsdroot.lv.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/git/root.bsdroot.lv.git'

I also tried to create bare repository and still no luck. I'm defiantly missing something simple here

any hints how to implement this?
 
I did many combinations of
Code:
# cd /
# git init
# git add ....
# git commit .
# cp -R .git /git/hostname.git
change some files
# git commit .
# git push /git/hostname.git
fail

Code:
# mkdir /git/hostname.git
# cd /git/hostname.git
# git init -bare
# cd /
# mkdir x
# cd x
# git clone /git/hostname.git
# mv .git /
# cd /
# rm -R x
# git add ....
# git commit .
# git push /git/hostname.git
fail
and many more different combos.....


and also my combos with little improvisation of this:
http://www.rubynaut.net/articles/2008/03/04/git-easy-way-to-setup-a-private-remote-repository
 
I think the first one fails because you're not really supposed to copy Git repos with cp(). $ git clone should be good enough.

Try this combo and see if it works:
Code:
# Setup main repo (bare)
$ mkdir /git/repo.git && cd /git/repo.git && git init --bare
# Local repo
$ mkdir ~/repo && cd ~/repo && git init
# Edit a file
$ vi foo
# Add file
$ git add .
# Commit
$ git commit

# Next, add origin
$ git remote add origin file:///git/repo.git
# Push the commit
$ git push origin master

After the first push, $ git push can be used to push commits to the master branch of origin directly.
 
Thanks.... that did the trick

grrrr, I was so close....
Thanks again, this was a big headache for me
 
Back
Top