简体   繁体   中英

git working directory not reflecting changes

I want my git repo to be in a separate directory from my working directory, so I made a repo using the following commands:

$ cd mysite.git/
$ git init --bare
Initialized empty Git repository in /home/git/mysite.git
$ git config core.bare false
$ git config core.worktree /home/mysite/public_html
$ git config receive.denycurrentbranch ignore
$ cat > hooks/post-receive
#!/bin/sh
export GIT_DIR=/home/git/mysite.git
export GIT_WORK_TREE=/home/mysite/public_html
git checkout -f
^D
$ chmod +x hooks/post-receive

I seem to be able to push and pull from the repo without error, but the working directory doesn't reflect the pushed changes.

If I do

$ git status

it shows that my changes were commited, but then removed from the working directory.

This configuration was working for my team until recently, and I'm not sure how to track down what might have changed. I've made sure that the file permissions seem to be correct. I'm not sure what else to check.

Can someone please help me figure out why my configuration is causing the working directory to not reflect the commited changes?

It turns out that the permissions in my repo directory were correct, but the permissions in my working directory were not. I had to make sure that the working directory was writable by the user that was doing the push.

"Bare" repos do not have worktrees. Maybe this will help?

You need to 'clone' the bare repo. Then you can push from the clone into the bare repo, and pull from the bare repo into the clone.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM