coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.78k stars 357 forks source link

Problem running git #336

Closed cyhccc closed 1 year ago

cyhccc commented 1 year ago

I used the git command in nodejs, but the following error will occur when using node-windows

//error.log warning: LF will be replaced by CRLF in gitAuto/daemon/gitauto.out.log. The file will have its original line endings in your working directory Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. warning: LF will be replaced by CRLF in gitAuto/daemon/gitauto.err.log. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in gitAuto/daemon/gitauto.out.log. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in gitAuto/daemon/gitauto.err.log. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in gitAuto/daemon/gitauto.out.log. The file will have its original line endings in your working directory Host key verification failed. fatal: Could not read from remote repository.

//gitAuto.js image

//service.js image

But when I run gitAuto.js normally, there will be no problem

image

why?

cyhccc commented 1 year ago

Git configurations are available image

this is my dir image

coreybutler commented 1 year ago

See https://github.com/coreybutler/node-windows/wiki#my-script-runs-fine-on-its-own-but-not-with-node-windows-why

The git.exe executable is globally available on your computer, but the error message suggests the .git project directory cannot be found (or the .git/config file within it). In your app where you run exec, you need to specify the working directory (cwd), otherwise it uses the node-windows directory (which doesn't have your .git directory).

cyhccc commented 1 year ago

See https://github.com/coreybutler/node-windows/wiki#my-script-runs-fine-on-its-own-but-not-with-node-windows-why

The git.exe executable is globally available on your computer, but the error message suggests the .git project directory cannot be found (or the .git/config file within it). In your app where you run exec, you need to specify the working directory (cwd), otherwise it uses the node-windows directory (which doesn't have your .git directory).

Okay, thank you very much for your answer