Sunday, December 7, 2014

Gitblit with Active Directory

[ERROR] Error Connecting to LDAP
LDAPException(resultCode=49 (invalid credentials), errorMessage='80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1 ', diagnosticMessage='80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1 ')
This could be the wrong password.
So I tested with my personal Active Directory account and it worked.
realm.authenticationProviders = ldap
realm.ldap.server = ldap://192.168.0.2
realm.ldap.username = [DOMAINNAME]\\duncansungwkim
realm.ldap.password = [YourPassword]
realm.ldap.accountBase = CN=Users,DC=[domainname],DC=[your-org],DC=com
Any Active Directory account in the "Domain Users" group will work.
In fact, you should ask your Active Directory administrator for the password of a special account that is only for anthentication. That account should be only in the "Domain Users" group, which I believe has the least rights.

Tuesday, April 1, 2014

Workaround of git Shallow Clone with Submodules

You can clone a git repo only with the most recent revision by using git's "shallow clone" as the following
command.
$ git clone --depth 1 https://github.com/MyRepo.git

If you have submodules, you would use the option --recursive as follows
$ git clone --depth 1 --recursive https://github.com/MyRepo.git
And you would expect that the submodules are also shallowly cloned, but they are actually full clones.

You can work around this problem by using consecutive commands in one line like the next
$ git clone --depth 1 https://github.com/MyRepo.git ; cd MyRepo ; git submodule update --init --depth 1
If you use Windows, use &(ampersand) instead of ; (semicolon).
C:\> git clone --depth 1 https://github.com/MyRepo.git & cd MyRepo & git submodule update --init --depth 1
This is such a primitive solution. However, this was really a good tip for using git for build automation.

One of my build jobs kept failing with the following error message.
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

It is said that this problem is caused by too big a git repo, maybe with over 20MB. I had big submodules but they were big due to its history. So I thought of the shallow clone, but it didn't work because git doesn't propagate the depth setting to the submodules when I use --recursive option. I couldn't wait for a new git version to fix this. Now I divided and conquered it.