phaonica
phaonica

Reputation: 21

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?

Upvotes: 1

Views: 255

Answers (2)

phaonica
phaonica

Reputation: 21

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.

Upvotes: 1

cdunn2001
cdunn2001

Reputation: 18307

"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.

Upvotes: 0

Related Questions