It's all about the answers!

Ask a question

"Error communicating with Git server" when register repo in RTC


jane zhou (106865) | asked Mar 10 '16, 4:17 a.m.
edited Jul 14 '16, 9:46 a.m. by Ralph Schoon (63.1k33646)

My RTC version is 6.02M2.
 
I am trying to create connection between RTC and git by using Nodejs Server.

I followed the instruction in the following link:
 https://jazz.net/wiki/bin/view/Main/RTCGitIntegrationSetupUsingNode

Nodejs server can start running successfully, because I noticed the log indicated this "Server started. Listening at port 8888."

Then I typed http://<my server ip>:8888/git/mybase.git  in browser as instructions mentioned above,
which trigger browser to prompt a window to let me input the username and password.
"The Server xx.xx.xx.xx is asking for your user name and password. The server reports that it is from RTC git server."

Then I typed my RTC user name and password, but it reply as "This page can't be displayed"
I tried to use random words as user name and password, the result is the same.
So I am afraid RTC server, as authentication server, did not work properly here. 

I am wondering anything wrong for my config of config.json?

  {
        "Version": 1,
        "Server-Use-HTTPS": false,
        "Server-Key-File-Path": "",
        "Server-Certificate-File-Path": "",
        "Server-Setup-HTTP-Redirector": true,
        "Server-Port": 8888,
        "Server-Socket-Timeout": 180000,
        "Git-Executable-Path": "git",
        "Git-Repositories-Root-Dir": "/home/myrepo/",
        "Git-Use-NodeGit": true,
        "Auth-Profiles": {
         "Ldap-1": {
            "type": "LDAP",
            "url": "ldap://<your server>",
            "bindDn": null,
            "bindCredentials": null,
            "searchBase": "ou=people,dc=test,dc=lan",
            "searchFilter": "(uid={{username}})",
            "searchAttributes": null
        },
        "Basic-1": {
            "type": "BASIC",
            "url": "https://<RTC server>:<port>/ccm/secure/authenticated/identity",
            "method": "GET"
        }
        },
       "Git-URL-Prefixes": {
            "/git": {
               "authProfile": "Basic-1"
            }
       }
     }

    Then when I tried to register repo in RTC server, from source control -> work with git-> register new repo,
my repo url is http://<my nodejs server ip>:8888/git/mybase.git , and I can save it to get a unique key.
    But when I tried to edit Git Authentication Details under "settings" tab, when I click "save" button, it reply as "Error communicating with Git server"

     When I tried to use git clone http://<nodejs server>:8888/git/mybase.git to clone code to my local linux pc,it always said it is a empty repo. But in fact, it is not, because when I use git clone by ssh to access gerrit server directly, I can fetch files back.
      And it also asked me for user name and password , but no matter what I typed in, it never fail. maybe this is caused by error above since I can not save "git authentication details" ?

     So I tried to git clone a *.git file not exist, such as http://<nodejs server>:8888/git/12345.git, it did not report error, and  it still said it is a empty repo. 
    but when I tried to git push changes back, it is always failed.

error: Cannot access URL http://<nodejs server>:<port>/git/mybase.git/, return code 22
fatal: git-http-push failed

    And when I use "git remote show origin" to check remote server config, HEAD is always unknown.
Username for 'http://<nodejs server>:8888': 1234
Password for 'http://1234@<nodejs server>:8888': 
* remote origin
  Fetch URL: http://<nodejs server>:8888/git/MyDemo.git
  Push  URL: http://<nodejs server>:8888/git/MyDemo.git
  HEAD branch: (unknown)
  Local branch configured for 'git pull':
    master merges with remote master

Why it is so so so difficult to use RTC to integrate with git? I have struggled several days... 
 Thanks for any kind of help and suggestion!

Best Regards,
Jane 



Comments
Lukas Steiger commented Mar 11 '16, 10:49 a.m. | edited Mar 11 '16, 10:50 a.m.

It seems that I'm facing the same issue as you. I've been reverse engineering and debugging for a couple of hours but couldn't really get further.

One thing that is important, is to execute

set RTC_GIT_SERVER_TRACE_LEVEL=4
in your command prompt before starting the server with 'node main.js'. This will give you additional log messages which should be helpful to trace down the issue.

In my case, the problem seems to be with the BASIC authentication not working:
11 Mar 16:42:43 - Services ERROR basicAuth(): Error while executing request; response code 302


Stephen Rooks commented Mar 18 '16, 12:23 p.m.

I'm hitting the same issue. If you remove the line "authProfile": "Basic-1", to make it unauthenticated do you get any further?


Lukas Steiger commented Mar 18 '16, 12:34 p.m.

No, not at all. The server kills itself as soon as I run the first request.

For me it seems like that there is an issue with certificates, I found the following line when working through the response returned by the server:
authorizationError: 'SELF_SIGNED_CERT_IN_CHAIN'



Stephen Rooks commented Mar 21 '16, 5:06 a.m.

Can you post the log? How did you switch on the logging?

5 answers



permanent link
Christian Schlag (111) | answered Jul 14 '16, 9:31 a.m.
 Hi,

I get the same issue. Did found a solution?

permanent link
Shubjit Naik (1.5k1613) | answered Jul 14 '16, 10:31 a.m.
edited Jul 14 '16, 12:20 p.m.
 Hi All

The error code 22 is seen when BASIC registry (CCM URL) for authentication is used in config.json with the default authentication mode in JTS/RTC. It works well when Nodejs server is configured against LDAP server.

Let me re-direct to our online documentation , Configuring Auth for Nodejs Server
Step 2c, "If your Jazz Team Server is configured to use HTTP Basic authentication, you can use the same server."

By default JTS is not configured with Basic Authentication, and we would need to change to Basic by editing the web.xml under  <jts ccm_war_extract="">\WEB-INF directory for the Authentication to work with GIT.

permanent link
Lukas Steiger (3131626) | answered Jul 15 '16, 1:57 a.m.
Hi all,

At least in my case, I had to modify the server files in the way that it uses a http(s) module that allows for redirection.
See the attached screen shot which lists the changes necessary that made it possible for us to get it up and running.

permanent link
Liora Milbaum (513282117) | answered Aug 27 '16, 10:23 p.m.
 This is my log:

28 Aug 02:11:00 - HTTPUtils INFO getLanguage(): first matching language =  en

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): cmd =  /usr/bin/git args =  [ 'config', 'rtc.repourl' ] outputCharEncoding =  utf8

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): child pid =  22059

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): cmd =  /usr/bin/git args =  [ 'config', 'rtc.repokey' ] outputCharEncoding =  utf8

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): child pid =  22060

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): cmd =  /usr/bin/git args =  [ 'config', 'rtc.skipaccessvalidation' ] outputCharEncoding =  utf8

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): child pid =  22061

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): close event of child process 22060 code =  0 signal =  null

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): close event of child process 22059 code =  0 signal =  null

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): close event of child process 22061 code =  1 signal =  null

28 Aug 02:11:00 - CLGitResourceProvider INFO getConfig.spawnCb(): err = Git Error: 'null' 1: 

28 Aug 02:11:00 - GitBackendService VERBOSE validateRepositoryAccess.onComplete(): err = null, rtcUrl = https://ec2-52-209-240-203.eu-west-1.compute.amazonaws.com:9443/ccm, rtcKey = 4598b63f54144f01b40aff64d724e464

28 Aug 02:11:00 - GitBackendService VERBOSE validateRepositoryAccess.onComplete(): postData = gitUser=liora&repositoryKey=4598b63f54144f01b40aff64d724e464

28 Aug 02:11:00 - GitBackendService VERBOSE handleGitRequest(): GET /git/JKEBanking-git-rtc.git

28 Aug 02:11:00 - GitBackendService VERBOSE handleGitRequest(): env = {"TERM":"xterm-256color","SHELL":"/bin/bash","XDG_SESSION_COOKIE":"be145668629f707675216cff000000fd-1472346652.863087-1926075962","SSH_CLIENT":"188.120.133.69 62377 22","OLDPWD":"/var/chef/cache/rtc-git-server-toolkit/server/git-lib","SSH_TTY":"/dev/pts/0","USER":"ubuntu","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:","RTC_GIT_SERVER_TRACE_LEVEL":"4","MAIL":"/var/mail/ubuntu","PATH":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games","PWD":"/var/chef/cache/rtc-git-server-toolkit/server","JAVA_HOME":"/usr/lib/jvm/java-7-openjdk-amd64","LANG":"en_US.UTF-8","NODE_PATH":"/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript","SHLVL":"1","HOME":"/home/ubuntu","LOGNAME":"ubuntu","SSH_CONNECTION":"188.120.133.69 62377 10.0.0.131 22","LC_CTYPE":"UTF-8","LESSOPEN":"| /usr/bin/lesspipe %s","LESSCLOSE":"/usr/bin/lesspipe %s %s","_":"/usr/bin/node","HTTP_HOST":"ec2-52-210-11-212.eu-west-1.compute.amazonaws.com:9999","HTTP_REFERER":"undefined","HTTP_USER_AGENT":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8","HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.8,he;q=0.6,de;q=0.4","HTTP_ACCEPT_ENCODING":"gzip, deflate, sdch","HTTP_ACCEPT_CHARSET":"undefined","QUERY_STRING":"","REMOTE_ADDR":"::ffff:188.120.133.69","REMOTE_HOST":"::ffff:188.120.133.69","REMOTE_PORT":"64322","REMOTE_USER":"liora","REQUEST_METHOD":"GET","REQUEST_URI":"/git/JKEBanking-git-rtc.git","PATH_INFO":"/JKEBanking-git-rtc.git","GIT_HTTP_EXPORT_ALL":"1","GIT_PROJECT_ROOT":"/gitrepos","RTC_GIT_SERVER_TOOLKIT_PATH":"/var/chef/cache/rtc-git-server-toolkit"}

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): cmd =  /usr/bin/git args =  [ 'http-backend' ] outputCharEncoding =  null

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): child pid =  22062

28 Aug 02:11:00 - OSUtils VERBOSE doSpawn(): close event of child process 22062 code =  0 signal =  null

28 Aug 02:11:00 - GitBackendService VERBOSE handleGitRequest.spawnCb():  { '0': 0,

  '1': <Buffer 53 74 61 74 75 73 3a 20 34 30 34 20 4e 6f 74 20 46 6f 75 6e 64 0d 0a 45 78 70 69 72 65 73 3a 20 46 72 69 2c 20 30 31 20 4a 61 6e 20 31 39 38 30 20 30 ... >,

  '2': <Buffer 52 65 71 75 65 73 74 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 3a 20 27 2f 67 69 74 72 65 70 6f 73 2f 4a 4b 45 42 61 6e 6b 69 6e 67 2d 67 69 74 2d 72 ... > }

28 Aug 02:11:00 - GitBackendService VERBOSE handleGitRequest.spawnCb(): result = { status: { statusCode: 404, reasonPhrase: 'Not Found' },

  headers: 

   { Status: '404 Not Found',

     Expires: 'Fri, 01 Jan 1980 00:00:00 GMT',

     Pragma: 'no-cache',

     'Cache-Control': 'no-cache, max-age=0, must-revalidate' },

  body: <Buffer > }

28 Aug 02:11:00 - GitBackendService VERBOSE handleGitRequest.spawnCb(): setting status code = 404

Any idea how to to further investigate?


Comments
Liora Milbaum commented Aug 29 '16, 4:08 p.m.

 Is the Apache HTTP server is required if I setup the nodejs server?


Shubjit Naik commented Aug 30 '16, 4:37 a.m.

No, Apache HTTP Server is not required when using nodejs server. You can either use nodes server  or Apache HTTP Server to host the Git repository.


Regarding the 404 error, could you share the config file and the environment you are running this on?


permanent link
Liora Milbaum (513282117) | answered Aug 30 '16, 5:48 a.m.
  config.json

{

    "Version": 1,

    "Server-Use-HTTPS"false,

    "Server-Key-File-Path""",

    "Server-Certificate-File-Path""",

    "Server-Setup-HTTP-Redirector"true,

    "Server-Port": 9999,

    "Server-Socket-Timeout": 180000,

    "Git-Executable-Path""/usr/bin/git",

    "Git-Repositories-Root-Dir""/gitrepos",

    "Git-Use-NodeGit"true,

    "Auth-Profiles"{

        "Ldap-1"{

            "type""LDAP",

            "url""ldap://<your server>",

            "bindDn"null,

            "bindCredentials"null,

                        "searchBase""ou=people,dc=test,dc=lan",

            "searchFilter""(uid={{username}})",

            "searchAttributes"null

        },

        "Basic-1"{

            "type""BASIC",

            "url""https://ec2-52-18-1-62.eu-west-1.compute.amazonaws.com:9443/ccm/secure/authenticated/identity",

            "method""GET"

        }

    },

    "Git-URL-Prefixes"{

        "/git"{

            "authProfile""Basic-1"

        }

    }

}


Comments
Liora Milbaum commented Aug 30 '16, 5:49 a.m.

 My environment is: 

CLM 6.0.2 on one instance
git with the nodejs application on the second one

Both instances are Ubuntu 12.04


Shubjit Naik commented Aug 30 '16, 6:19 a.m.

I see 2 possible issues here:


1. So you are using Basic Authentication. In that case you would have to enable BASIC authentication on CLM, by default it is FORM based.
For Liberty the path would change to [JAZZ_HOME]\server\liberty\servers\clm\apps

OR, if your CLM is connected to an LDAP server, connect nodejs to the same LDAP server through the config.json file.

2. On Ubuntu we saw an issue with pre-receive and post-receive hooks using /bin/sh.


Liora Milbaum commented Aug 30 '16, 6:21 a.m.

I have already faced both of the issues you mentioned and fixed them according to the answers you listed.


Shubjit Naik commented Aug 30 '16, 6:45 a.m.

We might have investigate further, could you raise a PMR on this?

I guess you would have followed the article below:


Liora Milbaum commented Aug 30 '16, 7:25 a.m.

 Yes. I did follow the article mentioned. I will raise a PMR.

Thanks


Liora Milbaum commented Aug 30 '16, 4:40 p.m.

BTW, found in the info center the next info:

Rational Team Concert Release 6.0 supports SSH as a communication protocol between Git repositories (client and server). The Jazz™ Team Server makes HTTP requests to Git server to retrieve commit details whenever a commit link is clicked in a work item. An HTTP server must be running on the Git server machine. If no HTTP server is running, you cannot view the commit page, which is displayed when you click a commit link from a work item. To retrieve commit-related information from the Git repositories, set up a Node.js server on a Git server machine.

So, maybe, I do need to setup apache2.

showing 5 of 6 show 1 more comments

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.