简体   繁体   中英

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.

Yes, git is independent of 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. Other companies offer free private git repositories (I use Assembla). But you can actually use git without any server as well, to maintain local version control. 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

Yes, absolutely. Github is doing nothing special in this regard. They host Git repositories and provide SSH and HTTPS to access them. Speaking SSH and HTTPS is all built into 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. 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...

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 is also using SSH, though probably with a number of performance enhancements.

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. 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.

See Git On The Server in the Pro Git book for more.


However I'd recommend against this. Hosting a raw Git repository provides none of the amenities of a full featured Git server . There's no risk to putting your code on Github, you can always move it somewhere else later. If you want you can also self-host a full featured server like Gitlab Community Edition .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM