使用git在窗口上管理网站 [英] managing website on windows using git

查看:132
本文介绍了使用git在窗口上管理网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行在Windows 2008服务器上的网站。我想知道使用git来管理该网站的最佳方式是什么。理想情况下,我需要一个自动部署,使用post-receive hook或类似的方法。



我有一台Linux服务器,我通常用作我的git原始服务器,所以我可以如果它使事情变得更容易,就利用它通常我的post-receive文件看起来像这样:

 #!/ bin / sh 
GIT_WORK_TREE = / var / www / example.com git checkout -f

显然,如果没有Windows,

我的Windows服务器支持FTP,但我希望尽可能使用更安全的功能。

解决方案

您可以在您的bash脚本中使用Windows路径(这将在Windows上由msysgit解释)。

<$ p $您可以看到 / $ / pre> $ / $ / $ p $ / $这里是一个相当复杂的 post-checkout hook (不是post-receive,但它可以说明你可以在bash钩子脚本中在Windows上做什么)。



更多详情请参阅 C ombing mingw和git



其实,亚当Rofer 在评论中提到:


如果您使用正常的Windows共享,您可以通过以下路径语法访问git存储库:

  //计算机名/文件夹/ repo.git 

假设文件夹是可以通过正常的Windows文件夹共享访问的共享文件夹。 Msysgit似乎与此相得益彰。



I have a website that is running on a Windows 2008 server. I want to know what is the best way to manage that site using git. Ideally I want an automated deployment, using a post-receive hook or similar.

I do have a Linux server that I typically use as my git origin server, so I can utilize that if it makes things easier. Typically my post-receive file there looks like this:

#!/bin/sh
GIT_WORK_TREE=/var/www/example.com git checkout -f

Obviously that won't work as-is on Windows without something else in place.

My Windows server supports FTP but I'd like to use something more secure if possible.

解决方案

You can use a Windows path in your bash script (which will be interpreted by msysgit on windows).

/C/my/path/...

You can see here an example of a fairly complex post-checkout hook (not a post-receive, but it can illustrates what you can do on Windows in a bash hook script).

More details in "Combining mingw and git".

Actually, Adam Rofer mentions in the comments:

If you use normal windows sharing, you can access git repositories via this path syntax:

//computername/folder/repo.git 

assuming folder is the shared folder accessible to your login via normal windows folder sharing. Msysgit seems to play well with this.

这篇关于使用git在窗口上管理网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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