gistup icon indicating copy to clipboard operation
gistup copied to clipboard

error: pathspec 'gistup' did not match any file(s) known to git

Open nswitanek opened this issue 10 years ago • 15 comments

Hi,

I've followed the "Let's Make a Block" tutorial and gotten stuck trying to run gistup. I've pasted the error below, which isn't addressed in your gistup troubleshooting section. At first I thought it might be a git configuration issue, but it looks like I've not set up my path variables correctly for npm-installed programs to run. Will check that first.

Thank you.

c:\Users\username\AppData\Roaming\npm\node_modules\gistup\lib\gistup\unless.js:11
    throw error;
          ^
Error: Command failed: error: pathspec 'gistup' did not match any file(s) known to git.
error: pathspec 'commit.'' did not match any file(s) known to git.

    at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

nswitanek avatar Jun 23 '15 22:06 nswitanek

This is almost certainly a Windows issue, and I’m afraid I won’t be much help at solving it. My guess from the cryptic error is that it’s failing inside the gitCommit function:

function gitCommit(callback) {
  child.exec("git commit --allow-empty -m 'Initial gistup commit.'", function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
    if (!error && stdout) process.stdout.write(stdout);
    callback(error);
  });
}

Specifically, it looks like your shell is not correctly parsing the single-quoted commit message (Initial gistup commit.) and is instead passing gistup and commit.' as separate arguments to git. Which of course fails.

It’s possible that gistup could be modified to support Windows, but my guess is that this would require substantial changes. So you might be out of luck. Sorry. :frowning:

mbostock avatar Jun 23 '15 23:06 mbostock

Understood. Thanks very much for your swift reply.

nswitanek avatar Jun 23 '15 23:06 nswitanek

I can bypass the mentioned error https://github.com/mbostock/gistup/issues/22#issue-90510743 using underscores like so

function gitCommit(callback) {
  child.exec("git commit --allow-empty -m 'Initial_gistup_commit'", function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
    if (!error && stdout) process.stdout.write(stdout);
    callback(error);
  });
}

CrandellWS avatar Sep 26 '15 16:09 CrandellWS

Ok it is creating the Gist on GitHub in MINGW64 using https://github.com/mbostock/gistup/tree/c6f3b193de8a99f6275496ec2dd6761b57c3e598

CrandellWS avatar Sep 26 '15 18:09 CrandellWS

So a note to myself https://github.com/CrandellWS/gistup/commit/ac982d14359cc529f5bf01c58fd4f728952e501c from where I had not realized there was a problem with ssh (had not even tried yet, thought it was setup but do to custom naming convience...)

CrandellWS avatar Sep 27 '15 01:09 CrandellWS

Got this much figured out from https://gist.github.com/leommoore/4484379#passing-environment-variables

function gitTestWin(callback) {
  var env = process.env,
    varName,
    envCopy = {};
    // Copy process.env into envCopy
    for (varName in env) {
      envCopy[varName] = env[varName];
    }
    envCopy['wtf'] = 'It is a win thing';
    child.exec("echo %wtf%", { env: envCopy}, function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("It has failed.");
    if (!error && stdout) process.stdout.write(stdout);
    if(error){
      console.warn(error.message);
    }
    console.warn('EXIT');
    process.exit(1);
  });
}

CrandellWS avatar Sep 27 '15 18:09 CrandellWS

Cross platform??>

var env = process.env,
varName,
envArgv,
envCopy = {};
// Copy process.env into envCopy
for (varName in env) {
  envCopy[varName] = env[varName];
}
envCopy['wtf'] = 'It is a win thing';

if(process.platform === "win32") {
  envArgv = "%wtf%";
} else {
  envArgv = "$wtf";
}
child.exec("echo " + envArgv, { env: envCopy}, function(error, stdout, stderr) {

CrandellWS avatar Sep 27 '15 19:09 CrandellWS

Here is what I have got so far https://github.com/CrandellWS/gistup/commit/6114d26d98d70968176975b094f2af86d5e4973c

Though it looks like more can still be done.

CrandellWS avatar Sep 27 '15 20:09 CrandellWS

With Windows this works

function gitCommit(callback) {
  child.exec('git commit --allow-empty -m "Initial gistup commit"',function(error, stdout, stderr) {
      if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
      if (!error && stdout) process.stdout.write(stdout);
      callback(error);
  });
}

vs this fails

function gitCommit(callback) {
  child.exec("git commit --allow-empty -m 'Initial gistup commit.'", function(error, stdout, stderr) {
    if (!error && stderr) process.stderr.write(stderr), error = new Error("git commit failed.");
    if (!error && stdout) process.stdout.write(stdout);
    callback(error);
  });
}

do not have current access to linux but it is assumed that there is reason to not just change it like mentioned if only because the message might contain unwanted character and what not...

CrandellWS avatar Sep 27 '15 21:09 CrandellWS

bit stuck on Right single quotation mark (U+2019) vs. Apostrophe (U+0027) not sure what to do

CrandellWS avatar Sep 27 '15 23:09 CrandellWS

deferred to

 child.exec('git config --get remote.' + crossPlatform.envVal('remoteName') + '.url || '+ crossPlatform.rEcho(),{ env: crossPlatform.newEnvVal('remoteName', argv.remote)}, function(error, stdout, stderr) {

CrandellWS avatar Sep 27 '15 23:09 CrandellWS

now you can see the rEcho (returned echo) in cross-platform.js this newer update partially works in MinGW and cmd.exe https://github.com/CrandellWS/gistup/commit/010814e68d97f9515c3870eafc417111ca295fed

still got the file issue to consider https://github.com/mbostock/gistup/issues/21

Can Someone test this on a linux system for me

CrandellWS avatar Sep 27 '15 23:09 CrandellWS

Windows users will hopefully find success using:

 npm install -g mkg

CrandellWS avatar Sep 28 '15 02:09 CrandellWS

The previous package was renamed to mkg so use npm install -g mkg to install.

Was able to get Ubuntu up and running to test the package and found it is now successfully working.

A side note for Ubuntu users getting npm running was not so straight forward. For my purposes the Best Solution To get npm working correctly on Ubuntu:

  1. Option 2 @ https://docs.npmjs.com/getting-started/fixing-npm-permissions
  2. Create soft link to nodejs for node in ~/bin -> ln -s which nodejs ~/bin/node

CrandellWS avatar Oct 09 '15 15:10 CrandellWS

This issue is fixed with the solution CrandellWS provided. Thanks @CrandellWS

gilsedition avatar Oct 04 '17 11:10 gilsedition