两人本地协作的 git 工作流程

发布于 2024-10-26 03:37:43 字数 356 浏览 9 评论 0原文

我们两个人在一个地方工作并同时讨论我们的想法,试图启动并运行一个新项目。

  1. git 将是首选版本控制系统,因为我很熟悉它
  2. ,我使用 Linux,而我的同事使用 Windows,
  3. 管理需求越少越好(我们希望专注于编码)
  4. ,我们有互联网连接和服务器(但保持3.记住)

第一个想法是将代码托管在 github 上,但由于代码应保持私有,因此这不是一个选择, 很遗憾。另一种方法是使用 git-daemon 以集中方式在本地托管一个人的存储库。

您对最佳(且简单)实践有什么建议吗?

We're two people trying to get a new project up and running while working in one place and discussing our ideas at the same time.

  1. git would be the preferred versioning system as I'm familiar with it
  2. I'm using Linux while my colleague uses Windows
  3. the lesser need for administration the better (we want to focus on coding)
  4. we have an internet connection and a server (but keep 3. in mind)

A first idea was to host the code on github but as the code should remain private this is not an option, unfortunately. Another one was to use git-daemon to host one persons's repository locally in a centralized fashion.

Do you have any advice on best (and easy) practice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

来世叙缘 2024-11-02 03:37:43

这里有几个选项,可以在网络本地完成所有操作,不需要太多管理。

通过 SMB 共享包含裸存储库的目录

如何让使用 Windows 的同事通过 SMB 共享一个目录,以便您可以使用 Samba 挂载它。然后,你们中的任何一个人都可以在该目录中创建一个裸存储库:

cd shared
mkdir project.git
git init --bare

... 并从中推送和拉取。

使用 SSH 访问计算机上的存储库

如果您愿意为协作者提供计算机上的帐户,您可以轻松创建一个共享的裸存储库,他可以通过 SSH 访问该共享存储库。如果他的用户帐户名为 bob,而您是 jnns,那么这只是一个问题:

sudo groupadd gitusers
sudo adduser jnns gitusers
sudo adduser bob gitusers
sudo mkdir -p /srv/git/project.git
sudo chown jnns:gitusers /srv/git/project.git
cd /srv/git/project.git
git init --bare --group=shared    

然后他可以像这样添加一个遥控器:

git remote add jnns-computer [email protected]:/srv/git/project.git

... 并且您可以将遥控器添加为:

git remote add local /srv/git/project.git

我不认为这算作很多管理员,但也许意见会有所不同:)


我觉得我也应该说,当你拒绝 GitHub 不是一个选择,因为你必须为私人存储库付费,你实际上不必支付太多费用 - 我认为每月 7 美元对于在这样的平台上拥有私人存储库来说是一个很好的交易服务顺畅。

Here are a couple of options for doing everything locally to your network that don't take much administration.

Sharing a directory over SMB that contains a bare repository

How about getting your Windows-using colleague to share a directory over SMB, so you can mount it with Samba. Then either one of you could just create a bare repository in that directory with:

cd shared
mkdir project.git
git init --bare

... and both push to and pull from that.

Accessing a repository on your computer with SSH

If you're happy to give your collaborator an account on your computer, you can easily create a shared bare repository that he can access with SSH. If his user account is called bob, and you're jnns, that's just a matter of:

sudo groupadd gitusers
sudo adduser jnns gitusers
sudo adduser bob gitusers
sudo mkdir -p /srv/git/project.git
sudo chown jnns:gitusers /srv/git/project.git
cd /srv/git/project.git
git init --bare --group=shared    

Then he can add a remote like this:

git remote add jnns-computer [email protected]:/srv/git/project.git

... and you can just add the remote as:

git remote add local /srv/git/project.git

I don't think that counts as a lot of admin, but maybe opinions would vary on that :)


I feel I should also say that while you reject GitHub as not being an option because you'd have to pay for private repositories, you really don't have to pay very much - I think $7 a month is a great deal for having private repositories on such a smooth service.

猫九 2024-11-02 03:37:43

您可以在服务器上托管 git 存储库。它不需要大量的管理。

就我个人而言,当我没有服务器时,我使用 DropBox 作为我的 git 存储库。 2GB 空间免费使用。

安装 DropBox 后:

$ mkdir my_src_dir && cd my_src_dir
$ git init

之后,您可以轻松地将代码推送到 dropbox 上 :-)


还存在其他替代方案,例如 projectlocker正如 Navin Aggrawal 或 Codaset 所说。

代码集
您创建的每个开源项目都是免费的,所以来吧,免费使用 Codaset。您的第一个私人或半私人项目也是免费的。

You could host your git repository on your server. It does not need a lot of administration.

Personally, when I don't have a server I use DropBox for my git repository. 2GB space available for free.

When DropBox is installed :

$ mkdir my_src_dir && cd my_src_dir
$ git init

After that, you can push your code on dropbox easily :-)


Other alternatives exist like projectlocker as Navin Aggrawal said or Codaset.

Codaset :
Every single open source project you create is free, so come on and use Codaset at no cost. Your first private or semi-private project is also free.

故事与诗 2024-11-02 03:37:43

如果您只想快速运行,有很多免费的 git 托管替代方案:
http://www.projectlocker.com

我相信您也意识到在您的服务器上您可以设置建立一个私人 git 仓库。


正如 SeyZ 上面所说,使用 dropbox 的唯一问题是您无法进行版本控制(因此,如果您不小心覆盖了某些内容,就会遇到麻烦)——而且您也无法同时进行远程/本地分支。我想说坚持使用 git ;)

如果你真的不关心版本控制,那么就选择 dropbox,当你想让多个人远程访问文件时,这是一项很好的服务。

There are a lot of git hosting alternatives that are free if all you wanna do is get running fast:
http://www.projectlocker.com

I'm sure you've also realized that on your server you could set up a private git repo.


The only problem with using dropbox as SeyZ says above, is that you don't get versioning (so if you accidentally overwrite something, you are in trouble) -- and you also don't get branching both remote/local. I'd say stick with git ;)

If you really don't care about versioning though then go for dropbox, it's a nice service to use in general when you want to have files accessed by more than one person remotely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文