How can I use a git bare repository to push into a non-bare repository? -
basically, want push local changes backup bare repository on remote server , have bare repositiory push changes production (non-bare) on same server. right now, i'm thinking of doing hook. i'm not using gitosis if matters. how can achieve goal?
i don't know if right way, want push local changes backup repo (bare) , non-bare repo.
tl;dr
you can't push non-bare repository.
three practical options
option 1
actually, can push non-bare repository if try hard enough, won't update working tree if do. example, push error message says:
you can set 'receive.denycurrentbranch' configuration variable 'ignore' or 'warn' in remote repository allow pushing current branch; however, not recommended unless arranged update work tree match pushed in other way.
you'd have change configuration on non-bare remote, , add post-receive hook update working tree. so, it's not useful when there easier ways go it.
option 2
you create post-receive hook on bare repository use ssh (or similar) connect remote host non-bare repository , pull whenever bare repository updated. pretty similar previous option, doesn't require configuration changes on non-bare repository.
option 3
polling option. similar https://stackoverflow.com/a/11254771/1301972, you're polling bare repository pull @ timed intervals. option requires no git configuration or custom hooks @ all, that's i'd recommend general solution if have access crontab.
Comments
Post a Comment