简体   繁体   English

具有多个用户的本地服务器上的Git

[英]Git on Local Server with Multiple Users

I have a question about Git! 我有一个关于Git的问题! Few days ago I setup a server, used for development, by 3 team members. 几天前,我由3个团队成员设置了一个用于开发的服务器。

When they want to fix bugs, develop new features or what ever, over the existing code, they remotely (Remote Desktop) connect to the server onto their windows account and they just type code. 当他们想修复错误,开发新功能或使用现有代码进行更新时,他们可以通过远程帐户(远程桌面)将服务器连接到Windows帐户,然后键入代码。

Later on, they perform this actions on the git bash: 稍后,他们在git bash上执行以下操作:

> 'git status' to check the modified files
> 'git add <files they modified>' to stage the files they modified
> 'git commit -m "message about the modification"' to persist the changes

Now, my question is, since all the developers are working directly over the repository, this is, they don't have a working copy to perform posterior commits to a central repo, is this ok or am I using git the wrong way? 现在,我的问题是,由于所有开发人员都直接在存储库上工作,因此,他们没有工作副本来执行对中央存储库的后继提交,这可以吗,还是我使用git的方式错误?

I ask this because, when someone modifies a file, and the other guy that is also editing the file, saves, the first to save, wins right? 我问这是因为,当有人修改文件,而另一个也在编辑文件的人保存时,第一个保存的人获胜了吗?

The above context was just to explain my situation and some doubts, the question I really want to ask with this topic is, what should I do to configure a source control in this case? 上面的背景只是为了解释我的情况和一些疑问,我真的想就此主题提出的问题是,在这种情况下我应该怎么做配置源代码控制?

Should each user have a working copy of the repository? 每个用户都应该拥有存储库的工作副本吗? Via "git clone" on the same machine? 通过同一台机器上的“ git clone”?

The way of working for a developer would be to 为开发人员工作的方式是

  1. git clone into a local space git克隆到本地空间
  2. Make changes 做出改变
  3. Commit them locally 在本地提交
  4. Push them to the repository you created on the server. 将它们推送到您在服务器上创建的存储库。

It is always recommended for each user to have a copy of the repository and work on it(Git is a distributed VCS). 始终建议每个用户都拥有存储库的副本并在其上工作(Git是分布式VCS)。 git clone helps you achieve that. git clone可帮助您实现这一目标。 The location where each user needs to have his/her own repository entirely depends on how you manage your projects. 每个用户需要拥有自己的存储库的位置完全取决于您如何管理项目。 It could be on the same server as the main repository or on a local storage. 它可以与主存储库位于同一服务器上,也可以位于本地存储中。

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

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