我有一个已初始化与当地的混帐回购协议: $ git的初始化Git的问题,推动本地服务器
我要推这一个开发服务器。
这是开发服务器上德目录结构: ROOT /的public_html ROOT/public_html.git
在public_html.git我已经初始化使用裸回购:
$git init --bare
然后我已经创建了一个后收到钩:
#!/bin/sh
GIT_WORK_TREE=/home/path/to/public_html
在本地计算机上我已经添加了遥控器:
$git remote add development ssh://location/public_html.git
我然后推本地回购远程使用:
$git push development master
这所有的工作,我已经得到了回购是successfuly推消息。
但是,这些文件不会复制到工作树中。该目录中不存在任何文件。使用
命令: sh /hooks/post-receive
检查是否后收到钩的工作会给我消息: 致命的:你是在一个分支尚未出生
我GOOGLE了此错误信息,但弹出的几页并不是很有帮助。
配置文件更改为:
[core]
bare = false
worktree = /home/path/to/public_html/
会让我使用git结帐-f将文件复制到工作目录,但是从地方到发展推给了我这个错误:
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
因此,我有点卡住:)
第二种方法不是我更喜欢的方法,但它确实帮助我将文件从回购站点传送到工作树。问题是推送到远程回购并不会更新在接收HOOK中设置的工作树中的文件。它显示了这样的信息:'致命的:你在一个分支尚未出生' –
再次。在接收后执行'git checkout'。 – basin
当然,有一次:'git clone public_html.git public_html' – basin