Hosting a git server on localhost

匆匆过客 提交于 2020-01-12 04:28:05

问题


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

Is there anyway I can use my localhost as remote ?

EDIT: I am on a windows machine


回答1:


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.

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

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.




回答2:


In Windows GitStack is an option, it is much more easy than Gitolite.




回答3:


Yes, just put a username as 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.

But I don't know why do you want to setup an another repository when "workcopy" is a repository indeed.



来源:https://stackoverflow.com/questions/20325089/hosting-a-git-server-on-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!