在本地主机上托管 git 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20325089/
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
Hosting a git server on localhost
提问by prometheuspk
My company does not have a central git server, and neither do they allow me to use BitBucket etc.
我的公司没有中央 git 服务器,他们也不允许我使用 BitBucket 等。
Is there anyway I can use my localhost as remote
?
无论如何我可以使用我的本地主机remote
吗?
EDIT: I am on a windows machine
编辑:我在 Windows 机器上
回答by Jan Krüger
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.
本地目录就像远程存储库 URL 一样工作,因此只要您是唯一使用存储库的人,基本上您无需执行任何操作。
Example, assuming Git Bash (from msysgit):
示例,假设 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
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 init
为您提供一个完整的 Git 存储库,您可以在其中进行提交和所有内容,也可以从中克隆和合并/拉取。大多数情况下,这确实是您所需要的。
回答by TonyHo
回答by eRIZ
Yes, just put a username as localhost: http://linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/
是的,只需将用户名设为 localhost:http: //linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/
The other option is to setup a Gitolite locally.
另一种选择是在本地设置 Gitolite。
But I don't know why do you want to setup an another repository when "workcopy" is a repository indeed.
但是我不知道当“工作副本”确实是一个存储库时,您为什么要设置另一个存储库。