Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx changesets-gitlab - git fetch origin main - unable to access URL using bad/illegal format or missing URL #116

Open
jorgecasar opened this issue Aug 10, 2023 · 16 comments

Comments

@jorgecasar
Copy link

Running npx changesets-gitlab I'm having this error, and I couldn't find any info about what could be the reason.

URL https://gitlab.company.com/project/path/name.git is correct and I could access by the browser.

Could you help us with any clue to look for a solution?

$ npx changesets-gitlab
::set-output name=published::false
::set-output name=publishedPackages::[]
setting git user
[command]/usr/bin/git config user.name Bot
[command]/usr/bin/git config user.email [email protected]
setting GitLab credentials
[command]/usr/bin/git checkout changeset-release/main
error: pathspec 'changeset-release/main' did not match any file(s) known to git
[command]/usr/bin/git checkout -b changeset-release/main
Switched to a new branch 'changeset-release/main'
[command]/usr/bin/git fetch origin main
fatal: unable to access 'https://gitlab.company.com/project/path/name.git/': URL using bad/illegal format or missing URL
Error: The process '/usr/bin/git' failed with exit code 128
    at ExecState._setResult (/builds/project/path/name/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/builds/project/path/name/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/builds/project/path/name/node_modules/@actions/exec/lib/toolrunner.js:469:27)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

[command]/usr/bin/git fetch origin main
fatal: unable to access 'https://gitlab.company.com/project/path/name.git/': URL using bad/illegal format or missing URL
Error: The process '/usr/bin/git' failed with exit code 128
@JounQin
Copy link
Member

JounQin commented Aug 10, 2023

Do you have a custom GITLAB_HOST environment?

@jorgecasar
Copy link
Author

Yes, Im using this variables:

variables:
  NPM_TOKEN: ${CI_JOB_TOKEN}
  GITLAB_HOST: https://${CI_SERVER_HOST}
  GITLAB_CI_USER_NAME: BOT
  GITLAB_CI_USER_EMAIL: [email protected] 

Could be a change in the configuration? The Gitlab version is GitLab Community Edition 15.11.2

@JounQin
Copy link
Member

JounQin commented Aug 11, 2023

I have no idea with this, maybe you'll need to use patch-package to debug.

@Arnoid31
Copy link

Arnoid31 commented Sep 12, 2023

Hello there! I'm encoutering the exact same issue, and can't find a clue even using patch-package to debug. It looks like the trailing / in the URL is totally at fault, but I can't find where it comes from.
Here are the logs when adding some git commands (remote origin set-url and remote -v especially):

[command]/usr/bin/git remote set-url origin https://BOT/ :[MASKED][email protected]/path/to/repository.git
[command]/usr/bin/git remote get-url --all origin
https://BOT/ :[MASKED][email protected]/path/to/repository.git
[command]/usr/bin/git -v
git version 2.39.2
[command]/usr/bin/git remote -v
origin	https://BOT/ :[MASKED][email protected]/path/to/repository.git (fetch)
origin	https://BOT/ :[MASKED][email protected]/path/to/repository.git (push)
[command]/usr/bin/git fetch https://BOT/ :[MASKED][email protected]/path/to/repository.git my-branch
fatal: unable to access 'https://gitlab.com/path/to/repository.git/': URL using bad/illegal format or missing URL

I'm not a Git specialist enough to understand if that's normal the remote is git: protocol but it becomes https: in fetch/in error log when fetching.
On local, with the same Git version, using git: procotol, everything is OK when I fetch.

@JounQin
Copy link
Member

JounQin commented Sep 12, 2023

@Arnoid31 Does git fetch origin main run successfully when you debug manually? I can only imagine it to be a git issue itself?

@Arnoid31
Copy link

Hello @JounQin, and thank you for your reactivity :)
I get exactly the same issue. But in fact I'm surprised we are using here an https: protocol with a .git suffix.
3 weeks ago, the job was working and the fetch was done this way:

[command]/usr/bin/git fetch origin my-branch
From https://gitlab.com/path/to/repository
 * branch            master     -> FETCH_HEAD

and everything was going well.
Another strange thing is, this is the only repository that fails this way, all the others using changesets-gitlab the exact same way are just fine.

@JounQin
Copy link
Member

JounQin commented Sep 12, 2023

@Arnoid31 Are you using different changesets-gitlab versions in different repositories? If so then maybe some recent releases could be related.

@Arnoid31
Copy link

Installed version is 0.10.3. I also tried with v0.10.1 which is run by another (working) repository and no change.

@JounQin
Copy link
Member

JounQin commented Sep 12, 2023

Are they running on same git version?

@Arnoid31
Copy link

You've got something here: working repo is running Git v2.20.1, not working is v2.39.2. Verified by using v2.20.1 on not working repo, and it works (but as a side effect I had to downgrade Node version from 20 to 16, so might also be related to Node version, but unlikely).

@Arnoid31
Copy link

Arnoid31 commented Sep 13, 2023

OK so, from what I see, it looks like finally the error comes from Node version. It works with a node:18.17 builder, but not with a node:20.
I can't investigate more for the moment, but maybe I'll get back to you if I have some time to proceed to some more investigations.

@JounQin JounQin pinned this issue Dec 19, 2023
@zoontek
Copy link

zoontek commented Mar 27, 2024

@JounQin I contacted you at the email address on your GitHub profile (admin(at)1stg(dot)me) to fund this issue investigation, but I'm not sure you are using it on day-to-day.

@AlexeyTeterin
Copy link

Faced exactly the same issue with node:20 after adding GITLAB_CI_USER_NAME variable.
Without variable everything is ok.

@JounQin
Copy link
Member

JounQin commented Apr 9, 2024

I check the source codes, the error should only occur at

await exec('git', ['fetch', 'origin', currentBranch])

It could be a git compatibility issue, I may need some more useful info like git/node versions, and maybe volunteer to help debugging like #145.

@robin-ln
Copy link

i have the same issue : https://gitlab.com/robin.louarn/monorepo-test/-/jobs/7603795314

$ node -v
v22.6.0
$ git -v
git version 2.39.2
$ pnpm exec changesets-gitlab
::set-output name=published::false
::set-output name=publishedPackages::[]
setting git user
[command]/usr/bin/git config user.name Robin LOUARN
fatal: not in a git directory
Error: The process '/usr/bin/git' failed with exit code 128
    at ExecState._setResult (/builds/robin.louarn/monorepo-test/node_modules/.pnpm/@[email protected]/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/builds/robin.louarn/monorepo-test/node_modules/.pnpm/@[email protected]/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/builds/robin.louarn/monorepo-test/node_modules/.pnpm/@[email protected]/node_modules/@actions/exec/lib/toolrunner.js:469:27)
    at ChildProcess.emit (node:events:520:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:[45](https://gitlab.com/robin.louarn/monorepo-test/-/jobs/7603795314#L45)7:11)
    at Socket.emit (node:events:520:28)
    at Socket.emit (node:domain:[48](https://gitlab.com/robin.louarn/monorepo-test/-/jobs/7603795314#L48)8:12)
    at Pipe.<anonymous> (node:net:337:12)

@robin-ln
Copy link

i have the same issue : https://gitlab.com/robin.louarn/monorepo-test/-/jobs/7603795314

$ node -v
v22.6.0
$ git -v
git version 2.39.2
$ pnpm exec changesets-gitlab
::set-output name=published::false
::set-output name=publishedPackages::[]
setting git user
[command]/usr/bin/git config user.name Robin LOUARN
fatal: not in a git directory
Error: The process '/usr/bin/git' failed with exit code 128
    at ExecState._setResult (/builds/robin.louarn/monorepo-test/node_modules/.pnpm/@[email protected]/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/builds/robin.louarn/monorepo-test/node_modules/.pnpm/@[email protected]/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/builds/robin.louarn/monorepo-test/node_modules/.pnpm/@[email protected]/node_modules/@actions/exec/lib/toolrunner.js:469:27)
    at ChildProcess.emit (node:events:520:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:[45](https://gitlab.com/robin.louarn/monorepo-test/-/jobs/7603795314#L45)7:11)
    at Socket.emit (node:events:520:28)
    at Socket.emit (node:domain:[48](https://gitlab.com/robin.louarn/monorepo-test/-/jobs/7603795314#L48)8:12)
    at Pipe.<anonymous> (node:net:337:12)
  • git config --global --add safe.directory $(pwd)

fix my problem for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants