Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

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.

Saturday, June 16, 2012

My .gitignore for XCode

# Mac OS X
*.DS_Store

# vi editor
*.swp

# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
xcuserdata/
build/
*.pch.*
*~.nib

Monday, October 3, 2011

Simply Set up Git on Apache

I actually referred to this blog page "8 ways to share your git repository".
I am using Linux as server. On my personal computer with Microsoft Windows I have installed [Git For Windows] and [Git Extentions] as client.
  1. It's really useful later to make the parent directory which holds all your git repositories. It can be used by 'gitweb'. On the server, make it and let's call it 'GitRepos' here.
    $ mkdir GitRepos
    $ chown -R apache:apache GitRepos

  2. Under the parent directory, make a git repository.
    $ cd GitRepos
    $ mkdir ProjectX
    $ cd ProjectX
    $ git --bare init
    Initialized empty Git repository in /GitRepos/ProjectX
    $ chown -R apache:apache .
    $ sudo -u apache git update-server-info

  3. I recommend using a virtual host solely for git because of useful 'gitweb' later on. Assign a dedicated subdomain such as 'git.mydomain.com' to it. To begin with, in '/etc/httpd/conf' directory, open 'httpd.conf', find 'Include conf.d/*.conf', type in 'NameVirtualHost *:80' at the line just before the found line.
    #
    # Load config files from the config directory "/etc/httpd/conf.d".
    #
    NameVirtualHost *:80
    Include conf.d/*.conf
    
    Search for the next same line as you have typed in and remove it so that the first one is unique.

  4. In '/etc/httpd/conf.d' directory, create or open 'git.conf' and add a virtual host as following.
    <VirtualHost *:80>
        ServerName git.mydomain.com
        Alias /ProjectX /GitRepos/ProjectX
        <Directory /GitRepos/ProjectX>
            DAV On
            Options +Indexes +FollowSymLinks 
            AllowOverride None
            Allow from all
            Order allow,deny
        </Directory>
    </VirtualHost>
    Note: Make sure that the alias doesn't overlap path names under subversion WebDAV. If so, you get the apache error "A subtree cannot specify a different DAV provider than its parent."(/var/log/httpd/error_log) and keep being asked to log in to fail.

    Restart the web server
    $ service httpd restart
    Stopping httpd:                                      [  OK  ]
    Starting httpd:                                      [  OK  ]
    
    Point your web browser to 'http://git.mydomain.com/ProjectX' and check if the physical git repository is shown as files and directories.

  5. On your PC, run "Git Extentions" and under "Common Actions" in the upperleft corner of the main window, choose "Create new repository", the last item.
    Put in a new path to ProjectX_Origin folder which I remcommend you delete later after setting up, choose "personal repository", and then click Initialize button.

  6. On the menu, choose Settings-Settings. The dialogbox pops up.
    Choose "Local Settings" tab, put "originator" into "User Name" and click Ok button. .

  7. Click "Edit .gitignore" button in the main window. The dialogbox pops up.
    Click "Add default ignores" button and then Save button.

  8. Click Commit button in the main window. The dialogbox pops up.
    Click ".gitignore" file, click Stage button, type in a comment like "added .gitignore.", and then click Commit button.

  9. On the menu, choose Remotes-"Manage remote repositories", "Remote repositories" dialogbox pops up.
    On "Remote repositories" tab, fill in Name editbox with "ProjectX" and type URL address "http://git.mydomain.com/ProjectX" into Url. and then click Save button. The following dialogbox pups up.
    Click Yes button, and then close the "Remote repositories" dialogbox.

  10. On the toolbar, click the push button which is marked by a red rectangle. The dialogbox pops up.
    Choose the remote name that you just made earlier from the dropdown list and then click Push button. The following dialog pops up.
    Click Yes button.
    Now the original initial repository got pushed into the server and everyone can share it.
    I recommend deleting the original local repository and cloning the remote repository for your own workspace.

  11. After cloning your own local workspace, choose menu "Settings-Settings" to pop up the dialogbox, Choose "Local settings" tab and then the third "Line endings" option "Checkout as-is, commit as-is".