I'm installing dependencies using bower in an older project. When running bower install on gitlab ci I get the following error:
ECMDERR Failed to execute "git ls-remote --tags --heads https://github.com/angular/bower-angular-sanitize.git", exit code of #128
What's weird is that it's not always the same repository when the error occurs.
I already tried to set a git user and email, as well rewriting git:// to https://
git config --global user.name "${GITLAB_USER_NAME}"
git config --global user.email "${GITLAB_USER_EMAIL}"
git config --global url."https://".insteadOf git://
According to this Question, error code 128 is a generic error code that is typically thrown by git when it is unable to access a remote repository.
I'm guessing that there are several possible reasons why git might be unable to access repositories here, including network connectivity issues, firewall or proxy restrictions, or the remote repository may be temporarily unavailable. Unfortunately I'm not sure how to debug this.
I'm not using a proxy.
When I run the same command using the same image locally, it works. Can anyone give me some guidance on how to troubleshoot this issue?
Partial output of bower install --json
:
, {
"level": "info",
"id": "resolved",
"message": "https://github.com/angular-ui/angular-google-maps.git#065568aa32",
"data": {
"endpoint": {
"name": "angular-google-maps",
"source": "angular-google-maps",
"target": "065568aa32954afa2c9de917542163cd5d3f2b5a"
},
"resolver": {
"name": "angular-google-maps",
"source": "https://github.com/angular-ui/angular-google-maps.git",
"target": "065568aa32954afa2c9de917542163cd5d3f2b5a"
}
}
}
, {
"code": "ECMDERR",
"details": "",
"exitCode": 128,
"data": {
"endpoint": {
"name": "angular-datatables",
"source": "angular-datatables",
"target": "~0.6.x"
},
"resolver": {
"name": "angular-datatables",
"source": "https://github.com/l-lin/angular-datatables.git",
"target": "~0.6.x"
}
},
"id": "ECMDERR",
"level": "error",
"message": "Failed to execute \"git ls-remote --tags --heads https://github.com/l-lin/angular-datatables.git\", exit code of #128\n",
"stacktrace": "Error: Failed to execute \"git ls-remote --tags --heads https://github.com/l-lin/angular-datatables.git\", exit code of #128\n\n at createError (/var/www/.npm/_npx/53/lib/node_modules/bower/lib/util/createError.js:4:15)\n at ChildProcess.<anonymous> (/var/www/.npm/_npx/53/lib/node_modules/bower/lib/util/cmd.js:102:21)\n at ChildProcess.emit (events.js:400:28)\n at maybeClose (internal/child_process.js:1088:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)"
}]
I was running on an older version of Ubuntu, where newer versions of Git weren't available by default. I was able to fix the issue by using the ppa provided on the Download for Linux and Unix page on the git.com website and then upgrading git.
The issue did not occur using the latest version of Git.