简体   繁体   English

在窗口服务器上自动启动git守护程序

[英]Auto start git daemon on window server

I am pretty new to Git. 我对Git很陌生。 Trying to setup git repository in window server 2008 R2. 尝试在Windows Server 2008 R2中设置git存储库。 I have finish with everything even tried to create new repository and cloning on same computer everything look good. 我已经完成了一切,甚至尝试创建新的存储库并在同一台计算机上进行克隆,一切看起来都很好。 Now I want to clone to my local computer using git protocol. 现在,我想使用git协议克隆到本地计算机。 While reading document I figure out that 在阅读文档时,我发现

git daemon --verbose --export-all

command will help and this trick work well for me. 命令会有所帮助,这个技巧对我来说效果很好。 Only issue for is I have to keep bash open. 唯一的问题是我必须保持bash开放。 Is there any way that command automatically run (may be through window service) ever after my window restart and run in background? 在我的窗口重新启动并在后台运行之后,命令是否有任何自动运行(可能通过窗口服务)的方式?

Also find another option that creating empty file git-daemon-export-ok in repository should work as well. 还可以找到另一个选项,即在存储库中创建空文件git-daemon-export-ok也应该起作用。 I had created file with same name under my bare repository but doesn't work. 我已经在裸存储库下创建了同名文件,但无法正常工作。

Any help? 有什么帮助吗?

What about running the following from Cygwin? 从Cygwin运行以下内容如何? This will set the daemon up as a typical Windows service that means you never need to worry about starting/stopping it again and you don't have to leave any windows open. 这会将守护程序设置为典型的Windows服务,这意味着您无需担心再次启动/停止它,也不必使任何窗口保持打开状态。

cygrunsrv --install git-daemon -p $(which git) --args "daemon --base-path=/cygdrive/c/Projects --base-path-relaxed"

... where /cygdrive/c/Projects is set to the location that is the parent directory of all your projects that you want to share. ... /cygdrive/c/Projects设置为您要共享的所有项目的父目录的位置。

Do not forget to give permission for each of your repositories to be exported by the daemon. 不要忘记为守护程序导出的每个存储库授予权限。 This can be achieved by running touch .git/git-daemon-export-ok in each repository that you want to export. 这可以通过在要导出的每个存储库中运行touch .git/git-daemon-export-ok来实现。

I found another alternative at this location . 我在这个位置找到了另一个选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM