Andrew Fletcher published: 5 September 2023 1 minute read
Git filename error when running the git add command. The error I'm receiving is
error: open("content/vendor/composer/1ab38258/drupal-core-c84bab7/modules/content_moderation/tests/modules/content_moderation_test_views/config/install/views.view.test_content_moderation_state_filter_base_table_filter_group_or.yml"): Filename too long
error: unable to index file 'content/vendor/composer/1ab38258/drupal-core-c84bab7/modules/content_moderation/tests/modules/content_moderation_test_views/config/install/views.view.test_content_moderation_state_filter_base_table_filter_group_or.yml'
fatal: adding files failed
The consequence of this error means nothing is added to git. So what's causing this issue? To begin it handy to know that Git has a limit of 4096 characters for a filename - clearly not issue in this situation. However, on Windows when Git is compiled with msys. It uses an older version of the Windows API and there's a limit of 260 characters for a filename. Therefore, the limitation is on msys rather than Git. To circumvent this issue, use another Git client on Windows or set core.longpaths to true.
How to set the git long paths:
git config --system core.longpaths true
Post running this command - running git add workd without issue.
Related articles
Andrew Fletcher
•
17 Feb 2024
Update a git feature branch to the latest branch (master)
In our projects, team members frequently generate new Git branches linked to the same Jira number, resulting in cluttered and disorganised structures that can pose challenges for both current and future developers. For instance:Jira: ABC-123Ticket work: Reformat headersOver time, these branches...
Andrew Fletcher
•
12 Oct 2023
What the following git commands do...
git reset, git revert, and git cherry-pick are three Git commands used for different purposes related to managing your version control history. Here's a brief overview of each command:git reset
git revert
git cherry-pick Snapshotgit revertis to roll back to a previous version of the repo...
Andrew Fletcher
•
29 Sep 2023
Adding a Git repo to a server
git clone git@bitbucket.org:{username}/{repo}.gitAnd I was unceremoniously delivered the following errorfatal: could not create work tree dir '{project}': Permission deniedMy initial thought was the error due to server permission... being sudo. This was tested by running the commandsudo git...