I have a personal laptop and a development box and want a setup with following things in mind:
--bare
repo.) I tried initializing a Git repo with code on dev box and cloned in on my laptop. I could not push changes to dev box though. It gives me the error that I am pushing to a non-bare repo.
Then I tried --bare
repo and it worked, but then I cannot run the code sitting on dev box. (Or can I?)
Any ideas on how to achieve this kind of setup?
One way to solve this is to create a third repo (that you can think of as the "main" repository) that is --bare
. To share changes, you can push to the bare repository from one machine and pull from the other.
If you put this bare repo on the web box, then you can set up a post-commit hook to automatically extract the files from the main repo to the (non-bare) repo that's used by the web server.
I usually don't set up such a post-commit hook, but my workflow is generally:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.