Reputation: 3018
I have my own private linux server. I am using it to host all my company git repositories. I am reading the .git
directories using python
. I also have a database that contain some information like the users who are allowed to login to the system.
The problem now, I have a linux user called git. the user has all the repositories, and when I try to connect from an outside machine I have to upload the SSH keys to the server before pulling and pushing.
What I am trying to do now.. Is to create an authentication layer like github. Where the users can clone or push to private repositories by entering the username and password for the system. Since the username and the password are in the database I need a python script OR any other script that will fetch the username and password.
The question now, when a user tries to do this.. git push origin master
for the first time. and there were no SSH key. I need something to say Please enter your username and password
if the user is authenticated using the data in my database AND have access to this repository then I want him/her to be able to push the repo or clone it.
Please don't mention ready software to host git repositories. This is not an option for me.
Upvotes: 2
Views: 556
Reputation: 1328912
Since you have ssh access, you can add an authorization layer like gitolite which will allow you to:
That way, no need for a user database, and you can manage your entire user base and access rules from the gitolite-admin
repo, a special administrative repo which will be interpreted on the server side by gitolite.
See more at "How do programs like gitolite work?".
Upvotes: 2