在本地主机上托管一个git服务器 [英] Hosting a git server on localhost

查看:137
本文介绍了在本地主机上托管一个git服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My company does not have a central git server, and neither do they allow me to use BitBucket etc.

是否有我可以使用我的本地主机作为 remote

Is there anyway I can use my localhost as remote ?

编辑:我在一台Windows机器上

I am on a windows machine

推荐答案

本地目录与远程存储库URL一样工作,因此只要您是使用存储库的唯一人员,就无需执行任何操作。

Local directories work just like remote repository URLs, so basically there's nothing you need to do as long as you're the only person using the repository.

示例,假设Git Bash(来自msysgit):

Example, assuming Git Bash (from 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存储库,您可以在其中进行提交和所有操作,以及可以克隆和合并/从。大多数时候,这真的是你需要的全部。

That said, just creating a normal local repository with git init gives you a complete Git repository in which you can make commits and everything, and which you can clone and merge/pull from. Most of the time, this is really all you need.

这篇关于在本地主机上托管一个git服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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