Git推动结账? [英] Git push to checkout?

查看:112
本文介绍了Git推动结账?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的文件直接推送到我的网络服务器。我将服务器添加为测试并尝试了

  git push testing 

但是我得到这个错误。制作裸存储库的解决方案能够正常工作,但我希望自动检出文件。我发现这个脚本,但这并没有改变任何东西。



我可以通过第三个裸仓库传输更改,但这需要很长时间:

  client: 
git commit -mtest-a
git push origin
< password>

server:
git pull origin / master

Update(2)



我在服务器上创建了一个新分支 git branch testing



另外在服务器上我创建了 .git / hooks / post-update 添加了一个:

  echoa>> / home / pi / log 
git update-server-info
git stash
git merge testing>> / home / pi / log

在客户端运行

  git push testing HEAD:测试

现在我的 / home / pi / log 包含:

  a 
更新ae2f44b..04753a9
快进
application / views / main / index.php | 2 + -
1个文件已更改,1个插入(+),1个删除( - )

但文件没有改变。还有什么可能会出错?

现在你该如何推送 - 部署(git 2.4,2015年5月)推送结帐(Git 2.3,2015年2月)



请参阅使用Git push部署项目

a>作为具体示例。

简而言之,您可以直接推送到已签出的分支(有注意事项)。

请参阅
commit 4d7a5ce


I want to push my files directly to my web server. I added the server as testingand tried

git push testing

but I get this error. The solution to make a bare repository works but I want the files to be checked out automaticly. I found this script but that did not change anything.

I can transfer changes over a third bare repository but that just takes to long:

client:
git commit -m "test" -a
git push origin
<password>

server:
git pull origin/master

Update (2)

I created on the server a new branch git branch testing.

Also on the server I created .git/hooks/post-update an added:

echo "a" >> /home/pi/log
git update-server-info
git stash
git merge testing >> /home/pi/log

On the client I run

git push testing HEAD:testing

Now my /home/pi/log contains:

a
Updating ae2f44b..04753a9
Fast-forward
 application/views/main/index.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

But the file did not change. What could still be wrong?

解决方案

You now how "push-to-deploy" (git 2.4, May 2015), which improves on "push-to-checkout" (Git 2.3, February 2015).

See "Deploy a project using Git push" for a concrete example.

In short, you can push directly to a checked out branch (with caveats).
See commit 4d7a5ce

这篇关于Git推动结账?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆