node-core-utils icon indicating copy to clipboard operation
node-core-utils copied to clipboard

Unhelpful error message when using unknown remote

Open anonrig opened this issue 2 years ago • 6 comments

I'm receiving a weird error running the following command:

git node land 48272
Error: git config,--get,remote.remote-upstream.url failed with stderr:
    at runSync (file:///Users/yagiz/.volta/tools/image/packages/node-core-utils/lib/node_modules/node-core-utils/lib/run.js:91:11)
    at new Session (file:///Users/yagiz/.volta/tools/image/packages/node-core-utils/lib/node_modules/node-core-utils/lib/session.js:30:26)
    at new LandingSession (file:///Users/yagiz/.volta/tools/image/packages/node-core-utils/lib/node_modules/node-core-utils/lib/landing_session.js:28:5)
    at main (file:///Users/yagiz/.volta/tools/image/packages/node-core-utils/lib/node_modules/node-core-utils/components/git/land.js:167:17)

anonrig avatar Jun 03 '23 17:06 anonrig

Can you paste the result of cat .git/config please?

aduh95 avatar Jun 03 '23 17:06 aduh95

cat .git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
[remote "origin"]
	url = [email protected]:anonrig/node.git
	fetch = +refs/heads/*:refs/remotes/origin/*

anonrig avatar Jun 03 '23 17:06 anonrig

You don't have a remote called remote-upstream, so ncu cannot read the URL associated with it. To fix the issue, you need to either create a remote remote-upstream, or change the .ncu/config file to use a different remote name (likely upstream).

aduh95 avatar Jun 03 '23 17:06 aduh95

Ah, you're right. I've setup the NCU incorrectly. Thank you @aduh95

anonrig avatar Jun 03 '23 17:06 anonrig

We could still decide to change the default to be upstream rather than remote-upstream and/or improve the error message when the git config call fails to hint into what might be wrong.

aduh95 avatar Jun 03 '23 17:06 aduh95

Definitely, that might be helpful, for cases like this.

anonrig avatar Jun 03 '23 17:06 anonrig