TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to Create Your Own Git Server

163 点作者 shill超过 11 年前

20 条评论

WestCoastJustin超过 11 年前
Running your own internal git server can have several advantages. Mainly, you are not sharing your code (IP) with external parties. There are many frontends you can strap onto a git server too, like Gitlab, Gitweb, Gerrit, and cgit [1, 2, 3, 4]. We use git&#x2F;gitolite&#x2F;gitweb heavily with our internal puppet infrastruture. You can have pre&#x2F;post commit hooks for things like, syntax checking, email notification, and code deployments.<p>Here is the workflow:<p><pre><code> +--------+ +---------+ | gitweb | |dashboard| staff +--------+ +---------+ nodes +-+ | | +-+ +-+-\ | | &gt; +-+ \ +--+-----+ +------+-&#x2F; | |git | |puppet| +-+ --&gt;| |gito-| +-&gt; |master| -&gt; +-+ +-+ | | lite| | | +-+ &#x2F; +--+-----+ +------+- &#x2F; | | \ +-+- | v &gt; +-+ +-+ | email hook to +-+ | staff if production branch v syntax hook </code></pre> I created a screencast about running an internal git server with gitolite @ <a href="http://sysadmincasts.com/episodes/11-internal-git-server-with-gitolite" rel="nofollow">http:&#x2F;&#x2F;sysadmincasts.com&#x2F;episodes&#x2F;11-internal-git-server-wit...</a><p>[1] <a href="http://gitlab.org/" rel="nofollow">http:&#x2F;&#x2F;gitlab.org&#x2F;</a><p>[2] <a href="https://git.wiki.kernel.org/index.php/Gitweb" rel="nofollow">https:&#x2F;&#x2F;git.wiki.kernel.org&#x2F;index.php&#x2F;Gitweb</a><p>[3] <a href="https://code.google.com/p/gerrit/" rel="nofollow">https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;gerrit&#x2F;</a><p>[4] <a href="http://git.zx2c4.com/cgit/" rel="nofollow">http:&#x2F;&#x2F;git.zx2c4.com&#x2F;cgit&#x2F;</a>
评论 #7198089 未加载
评论 #7199333 未加载
评论 #7198922 未加载
评论 #7198666 未加载
评论 #7198975 未加载
评论 #7197841 未加载
616c超过 11 年前
Interesing that no one mentions cgit,[0] even though Linus and kernel developers moved away from the default (it comes with git itself) Gitweb Perl CGI Library a while ago.[1]<p>Cgit is pretty impressive stuff as a frontend. I am sure it is a mess[2] (since people here constantly gawk and harp on people bold enough to do the following), but it is merely a giant C program handling CGI with built-in caching, and it is pretty damn efficient. It is crazy fast. I used to run it on a shared host, and boy was I impressed.<p>Give it a look when you have a chance. You would be surprised how many large FOSS groups (if I recall correctly, I see the UI at OpenOffice, GNOME, KDE, and FreeDesktop umbrella groups).<p>[0] <a href="http://git.zx2c4.com/cgit/" rel="nofollow">http:&#x2F;&#x2F;git.zx2c4.com&#x2F;cgit&#x2F;</a><p>[1] <a href="https://www.kernel.org/pelican.html" rel="nofollow">https:&#x2F;&#x2F;www.kernel.org&#x2F;pelican.html</a><p>[2] <a href="http://www.linux.com/news/software/applications/667176-cgit-maintainer-disappears-security-hole-found" rel="nofollow">http:&#x2F;&#x2F;www.linux.com&#x2F;news&#x2F;software&#x2F;applications&#x2F;667176-cgit-...</a>
评论 #7199791 未加载
zrail超过 11 年前
I wrote an article last year that builds this same idea with Gitolite, with bonus automatic replication to S3.<p><a href="http://www.petekeen.net/hosting-private-git-repositories-with-gitolite" rel="nofollow">http:&#x2F;&#x2F;www.petekeen.net&#x2F;hosting-private-git-repositories-wit...</a>
actionscripted超过 11 年前
If you&#x27;re doing all of that, why not take it a small step further and setup your own instance of GitLab? It&#x27;s a bit more work, but it&#x27;s by no means difficult if you follow the install directions.<p><a href="https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gitlabhq&#x2F;gitlabhq&#x2F;blob&#x2F;master&#x2F;doc&#x2F;install...</a>
评论 #7200677 未加载
评论 #7198677 未加载
评论 #7200679 未加载
评论 #7200678 未加载
KevinEldon超过 11 年前
Gitblit [1] is a nice option if you want an easy install (standalone app or Java WAR) and it runs fine on Windows if that is a constraint you have. It&#x27;s not as feature rich as some of the other choices out there, but it is actively developed and stable.<p>[1] <a href="http://www.gitblit.com/" rel="nofollow">http:&#x2F;&#x2F;www.gitblit.com&#x2F;</a>
评论 #7198553 未加载
ericedge超过 11 年前
I&#x27;m unclear on why this recommends setting up a user account for every committer. I&#x27;m a big fan of simply adding each committer&#x27;s ssh key to a single &quot;git&quot; user account to avoid the overhead of managing multiple user accounts--you have to make sure each ssh key line is identified by the user submitting it in case it needs removal in the future, but it&#x27;s much easier to manage adding and removing users.<p>There are some additional configuration steps for that single user, but most are covered in the manual at <a href="http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server" rel="nofollow">http:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;Git-on-the-Server-Setting-Up-the-...</a><p>Is there some advantage to separate user accounts that I&#x27;m missing?
Walkman超过 11 年前
Use the &quot;--shared&quot; switch if users will commit the repository from the machine. For details see [1]. I think this makes step 5 unneccesary. If your ssh daemon listens on other port than 22, you can still use relative URL-s to your repo owner home directory like this [2]: ssh:&#x2F;&#x2F;user@host:port:&#x2F;~&#x2F;repository.git<p>[1]: <a href="http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server" rel="nofollow">http:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;Git-on-the-Server-Setting-Up-the-...</a><p>[2]: <a href="http://stackoverflow.com/a/14349254/720077" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;14349254&#x2F;720077</a>
PetrolMan超过 11 年前
Just wanted to toss out another alternative in Stash by the folks at Atlassian. The setup was easy and it provides a nice interface that can hook in with Jira. Also, for small companies the 10 user license is free.
__david__超过 11 年前
If you trust all your devs, there&#x27;s also the even easier technique of just giving them accounts on the server and chgrp-ing a bare git repo so that they all have read&#x2F;write access.
Nux超过 11 年前
Don&#x27;t forget about GitBucket <a href="https://github.com/takezoe/gitbucket" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;takezoe&#x2F;gitbucket</a>
caniszczyk超过 11 年前
You can always use something like JGit: <a href="http://eclipse.org/jgit/" rel="nofollow">http:&#x2F;&#x2F;eclipse.org&#x2F;jgit&#x2F;</a><p>It&#x27;s the underlying library that powers tools like Gerrit Code Review.<p>Many ways to embed JGit too: <a href="http://alblue.bandlem.com/2013/11/embedding-jgit.html" rel="nofollow">http:&#x2F;&#x2F;alblue.bandlem.com&#x2F;2013&#x2F;11&#x2F;embedding-jgit.html</a>
评论 #7198350 未加载
smoyer超过 11 年前
Or you can just use Gitolite, Gitlab, etc
desireco42超过 11 年前
Without even reading this article I would say &#x27;EASY!&#x27;. Git definitely makes it very easy to host and work with repositories. I like to use gitolite for administration, it works really well. Even before it, when git came to be, I was using ssh to host one on dreamhost, it is that easy.
Gonzih超过 11 年前
I use gitolite as my own git server, pretty happy with it. Easy to configure and maintain.
irremediable超过 11 年前
Nice to see this summarised in one place. A lot of my projects are academic things that eventually end up on GitHub, but need to stay private for the first few months of their life. Hosting git on my VPS has been a godsend.
jtiseo超过 11 年前
I actually just started using Gitprep and it is extremely lightweight and easy to set up. I threw it on a 128MB BuyVM account I had and it worked flawlessly. I tried Gitlab first, and while it had more features, it was far more resource intensive (since it was Rails).<p><a href="http://gitprep.org/" rel="nofollow">http:&#x2F;&#x2F;gitprep.org&#x2F;</a>
droptableusers超过 11 年前
I use GitLab on my VPS (KVM Advanced @ Edis) and I am very happy with it. However, it uses unreasonable amount of resources. I am pretty much all out of resources after deploying GitLab. I will probably switch to something else even if it has less features and worse interface as long as it use less resources.
mcormier超过 11 年前
Been doing this for quite some time. I found the following blog posts very useful when I was learning how to do this.<p><a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way" rel="nofollow">http:&#x2F;&#x2F;scie.nti.st&#x2F;2007&#x2F;11&#x2F;14&#x2F;hosting-git-repositories-the-e...</a>
pavanred超过 11 年前
Am curious, I remember seeing a talk by Linus Torvalds on the internet where he explains git and how it incorporates a decentralized design to solve some inherent problems that the alternatives posed. Now, why is there emphasis on creating git servers?
评论 #7201755 未加载
aryastark超过 11 年前
If you just need something for yourself or a few people, you might consider an Android device. I use Gidder on a cheap tablet and it seems to work fine. Multiple users&#x2F;repos. Easy to setup. It has a DynDNS option as well.