问题
I am working to create a project management system that uses GIT. Right now it is on early stage. The idea is
- We have departments like "Design","Web","Android" and etc
- We have many projects under every department.
- 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
回答1:
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.
回答2:
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 gitolite 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.
来源:https://stackoverflow.com/questions/53598693/how-to-create-multiple-instances-of-git