In this tutorial I will show how to create a remote git server but keeping the repositories private, i.e. only the members of the repository can commit or query it, the rest of the users of other repositories can checkout that repository.
To achieve this goal, we will create a user in the server per repository. Let's say that we have to create two repositories: repo1 and repo2. Then we will have to create two users, and create different directories to hold the repositories for each of them. After that, we will have to add the public keys of the remote users to the .ssh/authorized_keys to enable the commits to that users.