在本地主机上托管Git服务器

19

我的公司没有中央git服务器,也不允许我使用BitBucket等。

有没有办法将我的localhost用作remote

编辑:我在Windows机器上。

3个回答

23
本地目录的工作方式与远程存储库URL相同,因此只要您是唯一使用存储库的人,基本上无需进行任何操作。
例如,假设使用Git Bash(来自msysgit):
mkdir /c/git
mkdir /c/git/testrepo.git
cd /c/git/testrepo.git
git init --bare
cd $TEMP
git clone /c/git/testrepo.git
cd testrepo
# hackety hack
git add .
git commit -m "I shouldn't be making commits like this but who's gonna sue me"
git push origin master
cd ..
git clone /c/git/testrepo.git testrepo2
cd testrepo2
# wow, all my files are here

话虽如此,只需使用git init创建普通的本地存储库,即可获得完整的Git存储库,您可以在其中进行提交等操作,并且可以从中克隆和合并/拉取。大多数情况下,这就是您需要的全部内容。


那么这样会在 Github 的环境选项卡中显示为部署吗? - Marvin
@Marvin 不,这完全不涉及任何网络访问,因此 GitHub 永远不会知道你在做什么。 - Jan Krüger
你知道我怎么在环境选项卡中获取除了 GitHub Pages 以外的部署吗? - Marvin

4
在Windows中,GitStack是一种可选方案,它比Gitolite更容易使用。

3

1
我正在使用Windows电脑。在Windows电脑上应该如何完成这个任务? - prometheuspk
http://stackoverflow.com/questions/20305832/cygwin-and-gitolite-3-how-to-set-it-up-on-windows - eRIZ
1
Gogs可能是一个更简单的解决方案:https://gogs.io/docs/installation/install_from_binary - eRIZ

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接