在局域网上创建远程服务器而不是使用 Git Hub
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21273826/
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
Creating a remote server on a LAN instead of using Git Hub
提问by Umair Cheema
Can I create my own remote server instead of using Git Hub?
我可以创建自己的远程服务器而不是使用 Git Hub 吗?
i.e Can I make a remote server on LAN where 3 computers are sharing a drive on a network to do the collaborative work using Gitbash? ?
即我可以在 LAN 上创建一个远程服务器,其中 3 台计算机在网络上共享一个驱动器以使用 Gitbash 进行协作工作吗??
采纳答案by First Zero
There are several ways to do this
做这件事有很多种方法
- Host internal repositories like Gitlabor Stash. This will be similar to services like BitBucket or GitHub
- If you want to have a simple service with SSH authentication - user3159253 has already answered that
- A very bare bones way is
- server: Create a bare repo:
mkdir -p RepoName && git init RepoName --bare
- server: Start the git daemon:
git daemon --base-path=$PWD/RepoName
- client:
Add your remote:git remote add origin git://server.url.or.ip/RepoName
or just clone it:git clone git://server.url.or.ip/RepoName
- server: Create a bare repo:
- 托管内部存储库,如Gitlab或Stash。这将类似于 BitBucket 或 GitHub 等服务
- 如果您想使用 SSH 身份验证的简单服务 - user3159253 已经回答了
- 一个非常简单的方法是
- 服务器:创建一个裸仓库:
mkdir -p RepoName && git init RepoName --bare
- 服务器:启动 git 守护进程:
git daemon --base-path=$PWD/RepoName
- 客户端:
添加您的遥控器:git remote add origin git://server.url.or.ip/RepoName
或只是克隆它:git clone git://server.url.or.ip/RepoName
- 服务器:创建一个裸仓库:
回答by user3159253
Yes, you do. Actually you need a SSH-service and git would perfectly work over SSH. Since you're on Windows, see Setup a Git server with msysgit on Windows
是的你是。实际上,您需要一个 SSH 服务,而 git 可以完美地通过 SSH 工作。由于您使用的是 Windows,请参阅在 Windows 上使用 msysgit 设置 Git 服务器