Reputation: 34038
I am trying to do a simple commit from VS Code in Github.
This is the output on the console:
git add -A -- .
warning: LF will be replaced by CRLF in dist/factory-method-web-part.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in lib/webparts/factoryMethod/components/FactoryMethod.d.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in lib/webparts/factoryMethod/components/FactoryMethod.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in lib/webparts/factoryMethod/components/ListItemFactory.js.
The file will have its original line endings in your working directory.
error: open("node_modules/@microsoft/office-ui-fabric-react-bundle/node_modules/office-ui-fabric-react/lib-amd/components/ChoiceGroup/examples/ChoiceGroup.Custom.Example.scss.d.ts"): Filename too long
error: unable to index file node_modules/@microsoft/office-ui-fabric-react-bundle/node_modules/office-ui-fabric-react/lib-amd/components/ChoiceGroup/examples/ChoiceGroup.Custom.Example.scss.d.ts
fatal: updating files failed
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master@{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
This is the content of my .gitignore file:
# Logs
logs
*.log
npm-debug.log*
# Dependency directories
node_modules
# Build generated files
dist
lib
solution
temp
*.sppkg
# Coverage directory used by tools like istanbul
coverage
# OSX
.DS_Store
# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
# Resx Generated Code
*.resx.ts
# Styles Generated Code
*.scss.ts
Why is GIT/VSCODE trying to commit a file under node_modules which should be ignored?
Upvotes: 0
Views: 168
Reputation: 1
I had the same error and it happens because your git configuration limits the length of the filenames. One of the possible solutions is to change this config using the below command as Administrator. Good luck!
git config --system core.longpaths true
Upvotes: 0
Reputation: 1295
You have to append a slash to the node_modules entry in your gitignore file. This is also true for all the other directory entries, like the coverage directory.
Your fixed lines in the gitignore file would look like the ones in the following snippet.
# Dependency directories
node_modules/
# Coverage directory used by tools like istanbul
coverage/
Upvotes: 2