I have a local repository called TestRepo. I clone it with the –bare option, zip this clone up, and throw it on my server. Unzip it, and it’s still bare.
I then clone the bare remote repository locally over ssh with something like
git clone ssh://git@host.com/~/TestRepo.git TestRepoCloned
The local TestRepoCloned is not bare and has a remote called “origin.” It appears to be tracking correctly from the looks of its config file
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://git@host.com/~/TestRepo.git
[branch "master"]
remote = origin
merge = refs/heads/master
I edit an existing file. I commit the change to the current branch (master) via
git commit -a -m "Edited a file."
The commit succeeds and all is well.
I decide to push this change to the remote repository via SSH with a
git push
The remote repository is now no longer bare, but has a complete working directory, and I get continuous error messages on all further attempts to push to it.
Everything I’ve read seems to suggest that what I’m doing is correct, but it simply is not working. How am I supposed to push changes to a bare remote repo and actually keep it bare?
It might be possible that zip/unzip does not preserve file permission (e.g. executable bit) and thus activates some previously deactivated hooks. You might want to check hook permissions on server or skip the whole zip part and just create bare repository directly on the server and upload our data using regular git push.