0

I am working to create a project management system that uses GIT. Right now it is on early stage. The idea is

  1. We have departments like "Design","Web","Android" and etc
  2. We have many projects under every department.
  3. We have GIT repository for each project.

For this purpose what i want to do is that create instances of GIT as many as departments. So every instance has its own SSH port number in any order e.g 1234 for "Design GIT Instance" and 1235 for "Web GIT Instance" and so on. So any department employees only access their relative department projects.
Question:
Can we make instances of GIT? if yes then how?I am very much new to GIT and ubuntu

Rafay Zia Mir
  • 2,116
  • 6
  • 23
  • 49
  • 1
    If I understand what you are trying to do, that is super weird. If you are trying to control access to different repos, then you should use things like [Bitbucket](https://bitbucket.org/product), [GitHub](https://github.com/), etc. Then you can set who can clone, who can push changes up, pull requests, etc. – Cory Kramer Dec 03 '18 at 17:19
  • What do you mean by "instance"? Do you mean an instance of a vm in a cloud? Do you mean a repo? If the latter, you create the repo either using `git init` or `git clone`, and you should expect every developer to have at least a few copies. – William Pursell Dec 03 '18 at 17:34
  • @WilliamPursell. By instance I mean a copy of GIT with a different Port number on same machine. May be i am not using proper terminologies. What i know from my initial knowledge of GIT is that a project contains a repository and repository contains different versions of that project. Now what i want is that placing projects related to Design dept under Design directory and give access to only Design Dept employees. – Rafay Zia Mir Dec 03 '18 at 17:59
  • @RafayZiaMir your terminology _is_ a little strange. But what you actually want is very simple. You simply want a different Git repository for each department. And each repository should have its own access control. GitHub, BitBucket, GitLab, and any other Git hosting service should provide this. – mkasberg Dec 03 '18 at 20:50

2 Answers2

3

Yes, a single server can serve multiple Git repositories. Don't think of it as multiple instances. It's just a file that's accessed over ssh.

Normally, you wouldn't do it by port number. (Again, it's not an instance. It's just a file.) Git is designed to be accessed by ssh. Put each repository at a different location (like .../design.git). Control access to the repository with Linux user credentials. Setting up a git server is a bit complicated and will require some Linux knowledge. The documentation will provide more information about how to do this.

It would probably be much easier to use BitBucket or GitHub or a similar service to set up and manage access to the repositories for you.

mkasberg
  • 16,022
  • 3
  • 42
  • 46
  • Ok. making sense to me. quick questions: Suppose we apply authentication. in that case Do we need to create same user every time when we create a new project? please question for beginner`s sake – Rafay Zia Mir Dec 04 '18 at 14:09
  • If you serve git over SSH, all authentication is also handled by SSH. You could create one user per repository and share the ssh credentials to anyone who needs to access it. Or you could create one (Linux) user per person, and put each person in a (Linux) user group that has read/write access for the repositories they need to access (using Linux file permissions). – mkasberg Dec 04 '18 at 17:52
1

In my opinion you make the solution harder than it should be. What you propose is possible but requires to much administration efforts.

If you insist on using ssh the better solution is gitolite. It's a program that allows you to run one instance of ssh server but have fine-grained access rights. In terms of gitolite your departments are groups, and you can grant or reject access to projects for groups or for individual users. There are many Q&A about at SO.

You can also consider a web-based git solution. See a list of possible solutions. The list is in no way complete. Gitlab CE (Community Edition) is perhaps the most elaborate environment. But most of them allow to create users and groups, and manage access permissions.

phd
  • 82,685
  • 13
  • 120
  • 165