简体   繁体   English

不同机器上的不同用户能否在不使用 GitHub 的情况下与单个 git 存储库协作

[英]Can different users on different machines collaborate with a single git repository without using GitHub

Is it possible for different developers to maintain and collaborate with a single git repository which is installed on a local computer without using any GitHub.不同的开发人员是否可以在不使用任何 GitHub 的情况下安装在本地计算机上的单个 git 存储库进行维护和协作。

Yes, git is independent of GitHub.是的,git 独立于 GitHub。 If you push your source to GitHub the with a free account your project will need to be 'public' meaning anyone can read it.如果您将源推送到 GitHub 并使用免费帐户,您的项目将需要是“公开的”,这意味着任何人都可以阅读它。 Other companies offer free private git repositories (I use Assembla).其他公司提供免费的私有 git 存储库(我使用 Assembla)。 But you can actually use git without any server as well, to maintain local version control.但是您实际上也可以在没有任何服务器的情况下使用 git 来维护本地版本控制。 This is definitely good practice anyway.无论如何,这绝对是一个好习惯。 A server would give you the added advantage of off site backup.服务器将为您提供异地备份的额外优势。

You can refer: https://medium.com/@udnisap/share-collaborate-code-with-git-without-github-or-internet-2a71991c0089可以参考: https://medium.com/@udnisap/share-collaborate-code-with-git-without-github-or-internet-2a71991c0089

Yes, absolutely.是的,一点没错。 Github is doing nothing special in this regard. Github 在这方面没有做任何特别的事情。 They host Git repositories and provide SSH and HTTPS to access them.他们托管 Git 存储库,并提供 SSH 和 HTTPS 来访问它们。 Speaking SSH and HTTPS is all built into Git. SSH 和 HTTPS 都内置在 Git 中。 You can provide the hosting.您可以提供托管。

For example, you could provide your contributors with SSH access to your server and permission to read/write your repository.例如,您可以为您的贡献者提供 SSH 访问您的服务器和读取/写入您的存储库的权限。 For example, if your server is you.example.com , the repository is at /path/to/the/repo.git , and I have a login with the user myself I can clone the repository with...例如,如果您的服务器是you.example.com ,则存储库位于/path/to/the/repo.git ,并且我自己使用该用户登录myself可以克隆存储库...

git clone myself@you.example.com:/path/to/the/repo.git

You might notice this is very similar to the git@github.com:owner/repo.git used by Github.您可能会注意到这与 Github 使用的git@github.com:owner/repo.git非常相似。 Github is also using SSH, though probably with a number of performance enhancements. Github 也在使用 SSH,尽管可能有一些性能增强。

Or if they're all working on the same machine you can clone the repository directly;或者,如果他们都在同一台机器上工作,您可以直接克隆存储库; this limits how one can work with the repository.这限制了如何使用存储库。

git clone /path/to/the/repo.git

Or you can literally copy the shared repository to a USB key and pass it around.或者您可以直接将共享存储库复制到 USB 密钥并传递它。 This obviously has limitations, people would only be able to push and pull when they have the USB key, but the point is Git works over many different transport layers.这显然有局限性,人们只有在拥有 USB 密钥时才能推拉,但关键是 Git 可以在许多不同的传输层上工作。

See Git On The Server in the Pro Git book for more.有关更多信息,请参阅 Pro Git 手册中的服务器上的 Git。


However I'd recommend against this.但是我建议不要这样做。 Hosting a raw Git repository provides none of the amenities of a full featured Git server .托管原始 Git 存储库无法提供功能齐全的 Git 服务器的任何便利 There's no risk to putting your code on Github, you can always move it somewhere else later.将您的代码放在 Github 上没有任何风险,您以后可以随时将其移动到其他地方。 If you want you can also self-host a full featured server like Gitlab Community Edition .如果您愿意,您还可以自行托管全功能服务器,例如Gitlab 社区版

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

相关问题 在2台不同的机器和github之间使用git - Using git between 2 different machines and github 在不同的机器上使用Git和Dropbox不会出现问题? - Using Git and Dropbox on different machines without Problems? GIT同一存储库在不同机器上的不同分支 - GIT same repository different branches on different machines 如何在不使用Github的情况下使用Git在项目中进行协作? - How to collaborate in a project using Git without using Github? 在不使用github的情况下为多个用户设置本地Git存储库 - Setting up a local Git repository without using github for multiple users 如何为具有不同访问权限的单个GIT存储库创建多个用户? - How to create multiple users for a single GIT repository with different access permissions? 我可以在安装了不同Git版本的机器之间安全地移动Git存储库吗? - Can I safely move a Git repository between machines with different Git version installed? 可以使用 git 在不同机器上同步 docker 容器吗? - Can you synchronize docker containers on different machines using git? Git 和 Github 显示存储库中的不同分支 - Git and Github showing different branches in repository 使用单个git存储库而不是子模块管理不同的代码库 - Manage different codebases using single git repository instead of submodules
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM