Is it possible to push to a separate repository from within the work-tree of a bare repository?

I have a central bare repository on my dev. web server that I use.

I have a post-receive hook that sets the work-tree to be a different directory, and all of my files are pushed there. Works peachy-keen. Keeps the git repository files separate from the actual code.

So, essentially, it's set up like this:

Git repo directory:
    /git/project.git

GIT_WORK_TREE:
    /var/www/project

I'd like to use my work-tree and set up another repository that pushes to a live server from this dev. one.

I'd like to do this so I can just push the finished files up to the live server without all of the extra tools and stuff, like my SASS and whatnot.

Could I just go into /var/www/project and git init? Will that break anything with my current repo?

Is there a better or known way of doing this?

Answers


Could I just go into /var/www/project and git init? Will that break anything with my current repo?

No it won't break anyhting.

As long as your hook does set GIT_DIR to /git/project.git and GIT_WORK_TREE to /var/www/project to checkout your files, the .git you would create within /var/www/project would be ignored.

Although I would create that repo outside of /var/www/project to be on the safe side.

The only risk is one of de-synchronization between the worktree of the /git/project.git and the one of your second git repo.


Need Your Help

Design pattern to apply over text normalizers chain

java design-patterns

I have a program that receives periodically files containing multiple lines that I process line by line. To process these lines I developed some text normalizers that work over the line to transfor...

How to get a column value from a webgrid by using jQuery in MVC

c# jquery asp.net-mvc

I have a webgrid shown below and I would like to get column value of 'id' column in jQuery. I did like $(this).find("#id").text(); $(this).val() and $(this).parent().find('id').text(); but no...