简体   繁体   English

如何在不使用Github的情况下使用Git在项目中进行协作?

[英]How to collaborate in a project using Git without using Github?

I am a beginner to Git and Github and still confused about them. 我是Git和Github的初学者,仍然对它们感到困惑。 It is said that we can use Git without Github when collaborating with other people. 据说我们可以在没有Github的情况下使用Git与其他人合作。 However, it is also said that Git works locally on one's computer. 但是,据说Git在一台计算机上本地工作。 If we do not use Github, how can we collaborate while Git works only locally? 如果我们不使用Github,我们如何协作,而Git只在本地工作?

You collaborate by swapping commits around among repositories and cooperating to whatever extent you find convenient on what to name interesting ones. 您可以通过在存储库之间交换提交来进行协作,并在任何程度上进行协作,以便找到有趣的名称。 That's it. 而已。 Really: that's all there is to it. 真的:这就是它的全部。

Github runs a server that speaks most of the main protocols git supports for swapping commits and refnames around, and it has a web GUI on top of a big helping of handy abstractions and features for browser-mediated access, but when it comes right down to it it's all about swapping commits. Github运行一个服务器,它代表git支持的大多数主要协议,用于交换提交和重新命名,并且它有一个Web GUI,可以提供方便的抽象和浏览器介导的访问功能,但是当它出现时它是关于交换提交的全部内容。 There's lots and lots of ways to do that, because the underlying structure is (quite literally incredibly) simple. 有很多方法可以做到这一点,因为底层结构(非常简单)非常简单。 It's so simple people don't believe it. 这是如此简单,人们不相信。

Your repos are yours; 你的回购是你的; what goes on in them is your business alone. 他们身上发生的事情就是你的事业。 The idea is getting commits into another repository is in some agreed-on (for each repo) sense publishing them. 这个想法是将提交到另一个存储库中的是一些商定的(对于每个repo)感觉发布它们。 What's in at least some (including your own) repos will include rough-draft commits and random notes, experiments and outright garbage that nobody wants. 至少在某些(包括你自己的)回购中,有什么东西包括草案提交和随机笔记,实验以及任何人都不想要的彻头彻尾的垃圾。 Nobody cares what's in your personal repos any more than they care what's in the notes on your desk, it's the ones you publish that matters. 没有人关心你个人回购中的东西,只关心他们关心你桌面上的笔记,这是你发布的重要内容。

Using multiple repos for a single-project workflow is common -- creating a sandbox clone for really experimental work quite literally doesn't take two seconds for even the largest repositories (any subsequent checkout might take some time). 对单个项目工作流使用多个存储库很常见 - 为真正的实验工作创建沙箱克隆,即使是最大的存储库也不会花费两秒钟(任何后续检出可能需要一些时间)。 You start doing clones to a tmpfs with barely a thought. 你几乎没有想到就开始为一个tmpfs做克隆。

And in every repo you have the full power of a world-class vcs available for your own exclusive and personal use. 在每个回购中,您都拥有世界级vcs的全部功能,可供您独家和个人使用。

Git is a version control software that sets repositories. Git是一个设置存储库的版本控制软件。 How it's done and how you manage them is another story, but the main point is that code stays in repositories. 它是如何完成的以及如何管理它们是另一个故事,但重点是代码保留在存储库中。 All repositories are identical, since this is a distributed system. 所有存储库都是相同的,因为这是一个分布式系统。 The problem is that when collaborating, the entire team needs access to the same repository. 问题是,在协作时,整个团队需要访问同一个存储库。

This is basically what github does: it creates a repository that acts as a main repository, and every team member synchronizes his repository with the "main" one (remember that the repository from github is the same as yours). 这基本上是github所做的:它创建一个充当主存储库的存储库,每个团队成员将其存储库与“main”存储库同步(请记住,github中的存储库与您的存储库相同)。

Why not sync it to the repository on your pc? 为什么不将它同步到电脑上的存储库? Because it's easier. 因为它更容易。 You would have to set up a server, to give your ip address, you may create security issues and so on. 您必须设置服务器,提供您的IP地址,您可能会产生安全问题等等。 But it could be done. 但它可以做到。 Also, if you really want to protect your code from a company for example, just create a git repository on a machine and sync everybody's repositories to that one. 此外,如果您真的想要保护您的代码免于公司,例如,只需在计算机上创建一个git存储库,并将每个人的存储库同步到该存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 团队如何使用 github 在 Laravel 项目上协作? - How do teams collaborate on a Laravel project using github? 使用没有远程服务器的Git进行协作 - Collaborate using Git without Remote Server 不同机器上的不同用户能否在不使用 GitHub 的情况下与单个 git 存储库协作 - Can different users on different machines collaborate with a single git repository without using GitHub 使用 docker-compose 协作处理现有的 git repo Django 项目 - Using docker-compose to collaborate on existing git repo Django project 使用git和单独的分支进行协作,而无需添加大量冗余提交 - Collaborate using git and separate branches without adding a bunch of redundant commits 使用GIT进行协作-第三方库 - Collaborate using GIT - 3rd party libraries 如何将Netbeans项目作为子文件夹推送到Github(使用Netbeans git)? - How to push a Netbeans project to Github as a subfolder (using Netbeans git)? 使用git与没有版本控制的人协作 - using git to collaborate with people w/o version control 如何不使用Git将GitHub存储库下载为Zip - How to download GitHub repo as Zip without using Git 如何在不使用 github 的情况下将本地 git 存储库部署到 VPS - How to deploy local git repo to VPS without using github
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM