承诺git我有这个问题。直到现在都没有这样的问题。
我可以去rm -rf .git
做所有的设置,然后git commit
工作得很好,但后来我做了几个小时的事情,尝试再次提交,这个消息。
我应该去安装他们要求我安装的nvm吗?有什么后果吗?
MacBook-Pro-3:testing NYC$ git commit -m "X"
Found '/Users/NYC/Desktop/testing/frontend/.nvmrc' with version <v6.11.1>
N/A: version "v6.11.1 -> N/A" is not yet installed.
You need to run "nvm install v6.11.1" to install it before using it.
Found '/Users/NYC/Desktop/testing/frontend/.nvmrc' with version <v6.11.1>
N/A: version "v6.11.1 -> N/A" is not yet installed.
You need to run "nvm install v6.11.1" to install it before using it.
husky > npm run -s precommit (node v8.2.1)
Error: fatal: Not a git repository: '.git'
at ChildProcess.<anonymous> (/Users/NYC/Desktop/testing/frontend/node_modules/staged-git-files/index.js:85:19)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:921:16)
at Socket.stream.socket.on (internal/child_process.js:348:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at Pipe._handle.close [as _onclose] (net.js:549:12)
husky > pre-commit hook failed (add --no-verify to bypass)
(nvm维护者在这里)
nvm
问题似乎是因为你有一个.nvmrc
文件,但你也选择了劫持cd
(或者你有一个git hook来做它)并自动调用nvm use
。
precommit钩子是husky
的一部分,nvm install
是一个完全不同的工具,处理git commit hooks。
首先,我运行.git/hooks
,只是为了确保安装它所要求的节点版本。
然后,我检查qazxswpoi并审核你安装的git hooks。
在那之后,事情应该好一点。