-1

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?

4

2 回答 2

4

这不应该发生。我的猜测是,要么存在某种钩子脚本(可能post-receive),它会导致结帐,要么是 Git 中存在错误。这两种可能性都不是很大,但这是我唯一能想象的。

于 2009-10-10T20:43:12.173 回答
3

zip/unzip 可能不会保留文件权限(例如可执行位),因此会激活一些以前停用的挂钩。您可能想检查服务器上的挂钩权限或跳过整个 zip 部分,直接在服务器上创建裸存储库并使用常规 git push 上传我们的数据。

于 2009-10-10T21:02:43.603 回答