Git and Active Directory / Ldap authentication

Thu, Apr 26, 2012
GitStack supports user authentication from Active Directory and any ldap compliant external system. Active Directory will be taken as an example in this tutorial.

GitStack provides two main features :
- Synchronization with Active Directory users in GitStack
- Authentication with Active Directory from your Git client (on clone and push)

We will go through the configuration of your git server with active directory.

1. Follow the Getting Started tutorial

Follow the Getting Started tutorial and stop before the “Add new user” step.

2. Create an user account for GitStack

On Active Directory, create a new user as usual with the username “gitstack”.
Enter a password and uncheck “User must change password at next logon”.

active directory user

new user git active directory

This user will be used to retrieve the list of Active Directory users.

3. Configure GitStack to authenticate with Active Directory

On GitStack, click on “Settings”, “Authentication” then on the “Ldap users” radio button. Fill the parameters.

gitstack ldap configuration

In our example we have :
protocol : ldap
host : 192.168.1.54
Base dn : CN=Users,DC=contoso,DC=com (Where our future users of GitStack are located)
Attribute : sAMAccountName (Field matching the active directory users username)
Scope : sub (“one” will search only on the current level, “sub” will search also on the lower levels)
Filter : (objectClass=person) (the type of objects you are searching for)
Bind DN : CN=gitstack,CN=Users,DC=contoso,DC=com (the distinguished name of our gitstack user)
Bind password : *****

Test you settings by clicking on the “Test ldap settings” button. A green “Ldap server successfully contacted” should appear at the top of the page.
Save you settings by clicking on the “Save” button.
Click on “Sync saved settings with ldap”. Your Active Directory users in the Base Dn will be imported into GitStack.

4. Add an Active Directory user to a git repository

Click on “Repositories”, “Permissions” icon and click on “Add user” button.
add ldap user git repo

add ldap user git repo_2

5. Clone and push from your Git Client


Your git repository is now correctly configured. You can now clone, commit and push from your git client using the user’s ldap credentials.
active directory git client