windows 在本地网络上运行 git 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21409264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run git server on local network
提问by MajAfy
I have a small company, for managing project I want run a git server in my company (local). How can I install git server on our local windows server?
我有一家小公司,为了管理项目,我想在我的公司(本地)运行一个 git 服务器。如何在我们的本地 Windows 服务器上安装 git 服务器?
I want my programmers can use git
commands to connecting to this server.
我希望我的程序员可以使用git
命令连接到这个服务器。
回答by CONvid19
I assume you already have your local Git set up. For that, there are plenty of resources on the Internet, including this blogpostabout Windows Git tooling.
我假设您已经设置了本地 Git。为此,Internet 上有大量资源,包括这篇关于 Windows Git 工具的博文。
The entire tricks works like this – expose folder containing your shared Git repository as Windows network share.
整个技巧是这样工作的——将包含共享 Git 存储库的文件夹公开为 Windows 网络共享。
Step one – bare git repository
第一步——裸git仓库
There are two twists to the entire solution – one of them is – your shared repository needs to be initialized with --bare flag.
整个解决方案有两个曲折——其中之一是——您的共享存储库需要使用 --bare 标志进行初始化。
Step two – Windows share
第二步——Windows共享
Second step is to expose the folder with our newly created repository on the Windows share. You also use your standard Windows mechanisms to control and limit access to the folder (make sure you give the developers write access!).
第二步是在 Windows 共享上使用我们新创建的存储库公开文件夹。您还可以使用标准的 Windows 机制来控制和限制对文件夹的访问(确保您授予开发人员写访问权限!)。
Step three – Map the share as network drive
第三步 - 将共享映射为网络驱动器
This step is perhaps not exactly necessary but I couldn't get it to work otherwise, so here comes the second twist. In order for your developers to be able to access the shared folder via Git they need to map it as network drive.
这一步可能不是完全必要的,但我无法让它工作,所以这里是第二个转折点。为了让您的开发人员能够通过 Git 访问共享文件夹,他们需要将其映射为网络驱动器。
Step four – Add remote repository in Git and code away
第四步——在 Git 中添加远程存储库并编写代码
Last step is the standard Git procedure – every developer on your team needs to add the repository sitting under their newly created network drive as remote. Notice the use of “file:///” prefix in front of the mapped drive name.
最后一步是标准的 Git 程序——您团队中的每个开发人员都需要将位于他们新创建的网络驱动器下的存储库添加为远程。请注意在映射驱动器名称前面使用了“file:///”前缀。