8

on a server, I want to have several git repositories. I want different users (=different SSH keys) to have access to different repositories (think of GitHub).

I know I can add a user's SSH key to authorized_keys on the server. But that would give the user access to all repos.

How can I set this up correctly? How does GitHub do it?

2 Answers 2

2

The easiest solution is to install a tool for managing remote access to git repositories, such as:

If you're not willing to use any of those options, you can hack something together by binding keys in your authorized_keys file to a specific command (using the command= option) that is a wrapper that validates repository access. This answer has some ideas that might help you get started.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, just what I was looking for
0

I made a project for this problem. A git repository manager with virtual authorizations: Custom virtual routes, specific access for each user to specific repositories only:

Features:

  • Access to specific repositories for each user.
  • Prevent expose original internal paths.
  • Prevent access to out storage directories.
  • Separate authorization for read and write access.
  • Prevent a command execution out of git shell.
  • Use multiple users with multiple access with only one ssh account.
  • Very lite, only one python script and one json settings, no need a big application with big databases structures.

https://github.com/WHK102/gitman

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.