Configure GitLab repository in Jenkins

I’m trying to configure Jenkins (running on Windows Server 2008) to connect to a GitLab 6.0 repository (on a linux box).

From my local windows box I can use the SSH URLs to clone the projects on my GitLab server. I’ve had some issues using the HTTP URLs, but I did manage to connect using HTTP with authentication using the Eclipse plugin.

  • Checkout from non-working branch and want to rebase to master
  • GitHub network graph representing wrong first parent after merge
  • Howto add a changed file to an older (not last) commit in Git
  • How to setup Gitlab Web Hook to deployment
  • What makes merging in DVCS easy?
  • How to get the SHA of the checked out code with ansible git module?
    • On the Jenkins project config screen I have attempted:

      http://myserver.domain/mygroup/myproject.git

    Failed to connect to repository :

    Command “d:\tools\Git\bin\git.exe ls-remote -h http://myserver.domain/mygroup/myproject.git HEAD”

    returned status code 128:

    stdout: stderr: error: The requested URL returned error: 504 while accessing

    http://myserver.domain/mygroup/myproject.git/info/refs?service=git-upload-pack

    fatal: HTTP request failed

    When I try this URL in a browser I get an authentication popup. If I enter my email & password I can successfully download the list of branches & tags.

    • …Okay, so I should be able to specify the username & password in the URL, right?

      http://username:password@myserver.domain/mygroup/myproject.git

    …nope:

    http://username:password@myserver.domain/mygroup/myproject.git/info/refs not valid: is this a git repository?

    • The Windows GUIs didn’t have any trouble using SSH.
      …Jenkins doesn’t seem to like that much though:

      git@myserver.domain:mygroup/myproject.git

      The error “Please enter Git repository” still remains, and when I attempt to save the config I see the following stack trace:

      Exception: java.lang.RuntimeException: Failed to instantiate class hudson.plugins.git.GitSCM from 
      {"value":"2",
       "userRemoteConfigs":     
         {"url":"git@myserver.domain:mygroup/myproject.git",
          "name":"origin","refspec":""
         },
       "branches":{"name":""},
       "includedRegions":"","excludedRegions":"","excludedUsers":"",
       "localBranch":"","relativeTargetDir":"","reference":"",
       "scmName":"",
       "gitConfigName":"","gitConfigEmail":"",
       "pruneBranches":false,"skipTag":false,"clean":false,"remotePoll":false,
       "disableSubmodules":false,"recursiveSubmodules":false,
       "authorOrCommitter":false,"wipeOutWorkspace":false,"ignoreNotifyCommit":false,
       "useShallowClone":false,"":["","0"],
       "gitTool":"Default",
       "browser":{"stapler- class":"hudson.plugins.git.browser.FisheyeGitRepositoryBrowser"}
      
      Stacktrace:
      javax.servlet.ServletException: 
      java.lang.RuntimeException: Failed to instantiate class hudson.plugins.git.GitSCM from {...}
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:725)
      ...
      Caused by: java.lang.RuntimeException: Failed to instantiate class hudson.plugins.git.GitSCM from {...}
        at hudson.model.Descriptor.newInstance(Descriptor.java:617)
        ...
      Caused by: java.lang.NullPointerException
        at hudson.scm.RepositoryBrowser.normalizeToEndWithSlash(RepositoryBrowser.java:85)
        at hudson.plugins.git.browser.FisheyeGitRepositoryBrowser.<init>(FisheyeGitRepositoryBrowser.java:37)
      
    • I tried adding the “ssh” protocol:

      ssh://git@myserver.domain:mygroup/myproject.git

    Jenkins immediately reacts:

    stderr: ssh: myserver.domain:mygroup: no address associated with name

    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repository exists.

  • fatal: unable to run 'git-svn'
  • Git revert last commit and remove it from history
  • Git: How to edit/reword a merge commit's message?
  • Reverse git depth=1
  • View git changes/diffs of local commits not pushed to remote
  • how can i parse the output of `defaults read` on OS X?
  • One Solution collect form web for “Configure GitLab repository in Jenkins”

    As I commented:

    Maybe Jenkins doesn’t support the scp syntax (with ‘:‘) Try

     ssh://git@myserver.domain/mygroup/myproject.git
    

    As mentioned in “.ssh config with amazon ec2 and git”, using ‘:‘ usually involves a ~/.ssh/config file, which resolves the string preceding the ‘:’ into a server, user, port and ssh key.

    Jenkins might understand better git@myserver.domain/mygroup/myproject.git instead of git@myserver.domain:mygroup/myproject.git.

    Git Baby is a git and github fan, let's start git clone.