Error unable to index file git

Dhananjay Kumar Unable to index file: Permission Denied error in git add command While working on an application, I had to commit changes to local Git Repository. It was usual task and I started with following command, To surprise git add command gave me error as shown in image below. Error message was clear […]

Содержание

  1. Dhananjay Kumar
  2. Unable to index file: Permission Denied error in git add command
  3. Unable to commit changes — Temp/Unitylockfile error #1039
  4. Comments
  5. Prerequisites
  6. Description
  7. Steps to Reproduce
  8. Additional Information
  9. Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
  10. Never ignore Asset meta data
  11. Uncomment this line if you wish to ignore the asset store tools plugin
  12. /[Aa]ssets/AssetStoreTools*
  13. TextMesh Pro files
  14. Autogenerated Jetbrains Rider plugin
  15. Visual Studio cache directory
  16. Gradle cache directory
  17. Autogenerated VS/MD/Consulo solution and project files
  18. Unity3D generated meta files
  19. Unity3D generated file on crash reports
  20. Builds
  21. Crashlytics generated file
  22. Git: невозможно индексировать файл – разрешено отклонение
  23. 6 Common Git Errors and How to Avoid Them
  24. Exploring some of the most common errors in Git
  25. fatal: not a git repository (or any of the parent directories)
  26. fatal: refusing to merge unrelated histories
  27. xcrun: error: invalid active developer path
  28. fatal: Unable to create ‘.git/index.lock’: File exists
  29. error: pathspec did not match any file(s) known to git
  30. permission denied (publickey)
  31. Final Thoughts

Dhananjay Kumar

Unable to index file: Permission Denied error in git add command

While working on an application, I had to commit changes to local Git Repository. It was usual task and I started with following command,

To surprise git add command gave me error as shown in image below. Error message was clear that to a particular file there was Permission denied.

Note: I was working on a MVC application which had local database attached. Name of database was MoviesRTM.mdf.

I tried to commit using Visual Studio 2013 as well. Here also I got same error as shown in image below,

This can be solved by two ways either shutting down IIS Express or restarting Visual Studio. I was using IIS Express to host MVC application. You can shut down IIS Express by right click on IIS Express and click on Exit from context menu.

If this option is not working then try restarting Visual Studio.

Note: Restarting Visual Studio or Shutting down IIS Express may worked in this scenario because permission denies error was on a database file (extension mdf). And database was locally created.

After shutting down I was able to run git add command successfully.

Источник

Unable to commit changes — Temp/Unitylockfile error #1039

Prerequisites

  • Be sure to run with tracing enabled to capture runtime details in the log file
  • Include the log file in the PR.
    • On Windows, the extension log file is at %LOCALAPPDATA%GitHubUnitygithub-unity.log
    • On macOS, the extension log file is at

    /Library/Logs/GitHubUnity/github-unity.log
    On linux, the extension log file is at

    Description

    Unable to commit changes.

    Steps to Reproduce

    1. Select files to commit and add description
    2. click commit

    Expected behavior:
    I expect the changes to be commited

    Actual behavior:
    After processing, the list of files under changes does not change and nothing is actually commited.

    Reproduces how often:
    100%

    Additional Information

    Any additional information, configuration or data that might be necessary to reproduce the issue.

    The text was updated successfully, but these errors were encountered:

    This file is not locked by any external process, so it looks like Github Unity is getting in its own way (unless this is a standard Unity file?)

    This is a standard Unity file, I don’t know why you’re getting this error, as the Temp folder should not be getting scanned, but I can’t tell what’s really going on without the full log :/

    @jwvanderbeck If you’re still around, let me know!

    Find Temp/UnityLockfile in the changed files on the left in Github Desktop.
    Right-click -> ignore file

    For anyone else having this problem, my solution was to change my .gitignore file to have a wild card before all the unity folders. My git directory was one folder above my unity project(so like «Gitfolder/UnityProject/Temp»), and as it looks like the .gitignore was expecting to be at the same level as the Temp folder(and other folders) it was not excluding the folders. Not sure if this will break anything, if not I would suggest GitHub change their default unity ignore file.

    Uhm, also does someone know how to post their gitignore file? I tried code, which as you can see bellow didn’t work out well.

    `# This .gitignore file should be placed at the root of your Unity project directory

    TextMesh Pro files

    Autogenerated Jetbrains Rider plugin

    Visual Studio cache directory

    Gradle cache directory

    Autogenerated VS/MD/Consulo solution and project files

    *ExportedObj/
    .consulo/
    *.csproj
    *.unityproj
    *.sln
    *.suo
    *.tmp
    *.user
    *.userprefs
    *.pidb
    *.booproj
    *.svd
    *.pdb
    *.mdb
    *.opendb
    *.VC.db

    *.pidb.meta
    *.pdb.meta
    *.mdb.meta

    Unity3D generated file on crash reports

    Builds

    Crashlytics generated file

    @78Star If you’ll note the comment at the very top of the file, it is intended to be placed in the root of your Unity project. If you choose to put it somewhere else then yeah it won’r work right an you will need to adjust accordingly. That isn’t GitHub’s responsibility really.

    Hello.
    I solved this problem with the instruction:
    echo «Temp/*» >> .gitignore

    For me, closing Unity just to add the objects and commit worked.

    For me, closing Unity just to add the objects and commit worked.

    Yes, this worked for me too 🙂

    @vicentselfa HI, i know temp file are unnecessary but did it cause any unpredictable errors?

    Don’t forget to change the .gitignore in the repository folder:

    It should have something like this:
    /[Ll]ibrary/
    /[Tt]emp/
    /[Oo]bj/
    /[Bb]uild/
    /[Bb]uilds/
    /[Ll]ogs/
    /[Mm]emoryCaptures/

    Remove the first slashes:
    [Ll]ibrary/
    [Tt]emp/
    [Oo]bj/
    [Bb]uild/
    [Bb]uilds/
    [Ll]ogs/
    [Mm]emoryCaptures/

    For anyone else having this problem, my solution was to change my .gitignore file to have a wild card before all the unity folders. My git directory was one folder above my unity project(so like «Gitfolder/UnityProject/Temp»), and as it looks like the .gitignore was expecting to be at the same level as the Temp folder(and other folders) it was not excluding the folders. Not sure if this will break anything, if not I would suggest GitHub change their default unity ignore file.

    Uhm, also does someone know how to post their gitignore file? I tried code, which as you can see bellow didn’t work out well.

    `# This .gitignore file should be placed at the root of your Unity project directory

    @78Star Alexander. I’m liking your explanation of the issue. but I’m way confused by the labeling of the /[Aa]ssets/TextMeshPro/ The rest of the folders in your code have */[Ff]older name , but not the Assets stuff. Huh? Is that intentional or just a miss? This doesn’t make sense to me. thanks,

    Источник

    Git: невозможно индексировать файл – разрешено отклонение

    Только для одного файла возникает следующая ошибка:

    Я проверил свои разрешения на соответствующий файл, .git каталог объектов и .git. Я могу добавить любые другие файлы, кроме этого. Я мог бы stat/r/w/touch файл, и прикосновение не помогло. Разрешения верны.

    Это какая-то сумасшедшая ошибка?

    Глядя на исходный код Git ( sha1_file.c , function move_temp_to_file() ), похоже, что Git не может переименовать временный файл с именем /opt/www/.git/objects/3f/tmp_obj_XXXXXX (где XXXXXX – шесть случайных символов) до /opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47 . Это может произойти, если у вас нет разрешения на удаление файлов в /opt/www/.git/objects/3f .

    Некоторые вещи, которые нужно попробовать:

    • Если несколько пользователей обращаются к репозиторию Git, вам может потребоваться выполнить что-то вроде git config core.sharedRepository 0664 (подробнее см. git help config ), чтобы убедиться, что вновь созданные каталоги и файлы имеют соответствующие разрешения для всех пользователей репозитория.
    • Попробуйте запустить rm -f /opt/www/.git/objects/3f/tmp_obj_* и убедитесь, что проблема устранена.

    Посмотрите, можете ли вы воспроизвести проблему за пределами Git, выполнив следующие действия:

    Обязательно запустите указанные выше команды тем же пользователем, у кого возникла ошибка.

  • Попробуйте рекурсивно chown ing и chmod в каталоге объектов.

Если вы используете Visual Studio или что-то подобное, генерирующее файл mdf, просто закройте VS и повторите команду git снова. На этот раз это должно сработать.

Чтобы сохранить закрытие и повторное открытие, вы должны добавить ссылки в файл .gitignore в корне проекта. Например, если это база данных, вызывающая проблему, добавьте следующее:

У вас нет разрешения на запись в /opt/www/.git/objects/3f .

Самое быстрое решение – использовать команду sudo для выполнения вашей команды с правами root.

Решил это для меня.

Что-то пошло не так в вашем git-репозитории, вероятно, из-за того, что внешний процесс создал файл или каталог, принадлежащий другому пользователю, а не текущему.

Эта ошибка часто встречается при использовании Docker, а служба в вашем файле docker-compose.yml имеет локально смонтированный том, который был создан с использованием пользователя, отличного от пользователя локального компьютера.

Если эта ошибка возникает впервые, выполните приведенные ниже действия в рабочем каталоге, чтобы изменить владельца файлов и папок обратно вошедшему в систему пользователю:

Если это не первый раз, когда вы сталкивались с этой проблемой, т.е. вы уже зафиксировали и отправили файлы и папки, принадлежащие другому пользователю, то вышеупомянутое само по себе не исправит ситуацию, а также не выполнит вышеуказанную команду – вы будете Необходимо выполнить следующие инструкции.

Безусловно, самое быстрое решение – выполнить следующее из корневого каталога проекта, в котором находится ваш git-репозиторий:

Чтобы проверить, что все исправлено, выполните следующее:

Быстро с последующим выполнением:

Вы увидите, что все было добавлено в репозиторий git без необходимости что-либо тестировать/возиться.

Просто закройте Visual Studio (или Unity) и попробуйте добавить эти файлы снова.

У меня была эта проблема в моем репозитории с исходным кодом, когда права были root: git 770, по-видимому, мне пришлось изменить его на 771, даже если мой пользователь находится в группе git. Я подозреваю, что, возможно, git, возможно, либо не знает ACL, либо не совместим со вторичными группами, так как в этом случае группа Git была одной из моих вторичных групп.

Источник

6 Common Git Errors and How to Avoid Them

Exploring some of the most common errors in Git

A Version Control System (VCS) is an essential tool for almost any development team that needs to keep track of the changes in the source code.

Git has been developed back in 2005 and today is by far the most commonly used VCS that is used by almost all development teams that require to version and archive their source code. In today’s article, we are going to cover a few of the most common Git errors and discuss how you can potentially avoid or fix them.

fatal: not a git repository (or any of the parent directories)

This is one of the most common errors, especially for newcomers to Git. Let’s suppose that you want to run git status in a particular directory:

The error indicates that the command cannot be executed because the current directory is not a Git directory. Usually, there are two main reasons why you might be getting the error.

  • You either forgot to initialize the repository as a Git repository using git init
  • or you are probably in the wrong directory. You can check your current work directory using pwd . It’s quite common for people to forget to change the directory when cloning a Git repository.

Another very common error after git pull or git merge is the one shown below:

This usually can happen mainly for two reasons;

  • The .git directory got corrupted. This hidden directory contains information relevant to your project that is being version controlled (for example, information about commits, remote repositories, etc.). If the directory is corrupted, git is unaware of the local history and thus the error will be reported when trying to push or pull to/from a remote repository.
  • You are trying to pull from a remote repository that already has commits while you have also created a new repository locally and added commits as well. In this case, the error will be reported since Git is unaware of how these two are related (they are pretty much interpreted as two distinct projects).

If this is the case, then you need to provide the —allow-unrelated-histories flag. For example,

There’s also a chance of getting this error when trying to rebase and requires different treatment.

The process of combining commits to a new base commit is called rebasing. In other words, rebasing simply changes the base of the branch to a different commit so that it appears as if you have created the branch from that particular commit. The diagram below illustrates accurately the way rebasing works in Git.

When git rebase fails with this error rebase does not get aborted but is still in progress. Instead, you can actually intervene manually.

To solve the issue you first need to merge and commit , and finally force rebase to continue:

xcrun: error: invalid active developer path

This is a common error for OSX users that is even more frequent when a new major OSX release is made. The error is reported when you attempt to run any git command. For example,

The issue is related to Xcode Command Line Tools version that needs to be updated so that the error is resolved. To do so, open the terminal and run

The response should be

while a pop-up window will appear on your screen asking you to confirm that you want to install command line developer tools.

Simply click install, wait for the installation to complete and open a new terminal session. Git commands should now work as expected.

fatal: Unable to create ‘.git/index.lock’: File exists

When a git process crashes in one of your Git repositories you may see the error shown below when you attempt to run a git command:

If no other git process is running, you can quickly fix this by manually removing the file:

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

Usually, when you create a new branch using say the web UI of GitHub and go back to your local terminal to checkout to the branch using

you may get this error

This usually means that your local repository is not up to date with the latest information for the remote Git repository. To fix the issue you simply need to fetch the information for the newly created branch:

Now git checkout should work fine.

permission denied (publickey)

In order to clone remote repositories to your local machine you need to ensure that you have properly configured authentication.

If you attempt to clone a repo and the response is

Now there are potentially a couple of ways to resolve this issue. The easiest way is probably to instead use HTTPS to clone the repository to your local machine that requires no public key validation:

Alternatively, if you still need to use SSH to clone the repository you’ll have to generate SSH public and private keys in order to configure proper authentication. To do so, make sure to follow the steps below.

  • Navigate to your local .ssh directory and run ssh-keygen to generate keys
  • Now you need to copy the content of the generated file id_rsa.pub
  • Add the key to the appropriate section on GitHub website
  • Make sure your git configuration is correct

And you should now be able to clone the remote repository using SSH. For more details, you may refer to GitHub documentation.

Final Thoughts

In today’s article, we explored a few of the most common errors in Git. For each of them, we discussed potential reasons that may be triggering these errors as well as how to fix them.

Git is definitely a very powerful tool and is way more complicated than it may sometimes look like. The community is great though and the Internet is full of resources to help you resolve any issue you may be having with Git.

Источник

Вопрос:

Только для одного файла возникает следующая ошибка:

error: unable to write sha1 filename /opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47: Permission denied

error: wp/wp-admin/css/theme-install.dev.css: failed to insert into database
fatal: unable to index file wp/wp-admin/css/theme-install.dev.css

Я проверил свои разрешения на соответствующий файл, .git каталог объектов и .git. Я могу добавить любые другие файлы, кроме этого. Я мог бы stat/r/w/touch файл, и прикосновение не помогло. Разрешения верны.

Это какая-то сумасшедшая ошибка?

Лучший ответ:

Глядя на исходный код Git (sha1_file.c, function move_temp_to_file()), похоже, что Git не может переименовать временный файл с именем /opt/www/.git/objects/3f/tmp_obj_XXXXXX (где XXXXXX – шесть случайных символов) до /opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47. Это может произойти, если у вас нет разрешения на удаление файлов в /opt/www/.git/objects/3f.

Некоторые вещи, которые нужно попробовать:

  • Если несколько пользователей обращаются к репозиторию Git, вам может потребоваться выполнить что-то вроде git config core.sharedRepository 0664 (подробнее см. git help config), чтобы убедиться, что вновь созданные каталоги и файлы имеют соответствующие разрешения для всех пользователей репозитория.
  • Попробуйте запустить rm -f /opt/www/.git/objects/3f/tmp_obj_* и убедитесь, что проблема устранена.
  • Посмотрите, можете ли вы воспроизвести проблему за пределами Git, выполнив следующие действия:

    mkdir -p /opt/www/.git/objects/3f
    cd /opt/www/.git/objects/3f
    rm -f tmp_obj_* ce3587c54a8be14c69b08c6b01f94949b11b47
    echo "testing" >tmp_obj_abcdefg
    mv tmp_obj_abcdef ce3587c54a8be14c69b08c6b01f94949b11b47
    rm -f tmp_obj_abcdefg
    

    Обязательно запустите указанные выше команды тем же пользователем, у кого возникла ошибка.

  • Попробуйте рекурсивно chown ing и chmod в каталоге объектов.

Ответ №1

Если вы используете Visual Studio или что-то подобное, генерирующее файл mdf, просто закройте VS и повторите команду git снова. На этот раз это должно сработать.

Чтобы сохранить закрытие и повторное открытие, вы должны добавить ссылки в файл .gitignore в корне проекта. Например, если это база данных, вызывающая проблему, добавьте следующее:

# SQL Server files
*.mdf
*.ldf

Ответ №2

У вас нет разрешения на запись в /opt/www/.git/objects/3f.

Самое быстрое решение – использовать команду sudo для выполнения вашей команды с правами root.

sudo <Your git command>

Решил это для меня.

Ответ №3

Что-то пошло не так в вашем git-репозитории, вероятно, из-за того, что внешний процесс создал файл или каталог, принадлежащий другому пользователю, а не текущему.

Эта ошибка часто встречается при использовании Docker, а служба в вашем файле docker-compose.yml имеет локально смонтированный том, который был создан с использованием пользователя, отличного от пользователя локального компьютера.

Если эта ошибка возникает впервые, выполните приведенные ниже действия в рабочем каталоге, чтобы изменить владельца файлов и папок обратно вошедшему в систему пользователю:

sudo chown -R ${USER}:${USER} .

Если это не первый раз, когда вы сталкивались с этой проблемой, т.е. вы уже зафиксировали и отправили файлы и папки, принадлежащие другому пользователю, то вышеупомянутое само по себе не исправит ситуацию, а также не выполнит вышеуказанную команду – вы будете Необходимо выполнить следующие инструкции.

Безусловно, самое быстрое решение – выполнить следующее из корневого каталога проекта, в котором находится ваш git-репозиторий:

sudo chown -R ${USER}:${USER} .git/objects

Чтобы проверить, что все исправлено, выполните следующее:

git add .

Быстро с последующим выполнением:

git status

Вы увидите, что все было добавлено в репозиторий git без необходимости что-либо тестировать/возиться.

Ответ №4

Просто закройте Visual Studio (или Unity) и попробуйте добавить эти файлы снова.

Ответ №5

У меня была эта проблема в моем репозитории с исходным кодом, когда права были root: git 770, по-видимому, мне пришлось изменить его на 771, даже если мой пользователь находится в группе git. Я подозреваю, что, возможно, git, возможно, либо не знает ACL, либо не совместим со вторичными группами, так как в этом случае группа Git была одной из моих вторичных групп.

I’ve seen many of the other threads about this and they don’t help.

I have a very simple repo — two JavaScript files. I have 100+ GB on Macbook. When I try to move the files into a subdirectory and stage locally the changes I get …

fatal: Unable to write new index file

This happens whether I do all actions in terminal or if I use a GUI like SourceTree. Additionally, one of the files becomes locked and I cannot delete the working directory until I log off and back in.

Why is this happening? Is the lock preventing something from staging? If so, what/how do I unlock the problem file on OS X?? The remote repo is Google Code, if that makes a difference, though I am not pushing to the remote yet. Everything is local.

26 Answers

In my case, the disk ran out of space, so I had to delete files from the hard drive to make space.

I’ve been having this same problem for the last few days. Basically, without my knowledge the entire repo had been moved to a new filesystem, when I tried to run git status, it was suddenly reporting that every file in the repo had been udpated.

Possible solutions

So, after much google scouring, I tried the following:

  • changing .git permssions (same issue)
  • changing .git/index permissions (same issue)
  • git add-ing all the changes to commit (same issue)
  • git rm-ing deleted files, since they were reporting file name too long errors (same issue)
  • git reset (soft|Head|Hard) (same issue)
  • git clean (same issue)
  • turning off windows defender (same issue)
  • updating git (same issue)
  • different git clients (i use gitbash) (same issue)
  • drinking 2 coffees instead of 1 (same issue)

tl:dr — dirty solution

The only thing that managed to solve the issue was to copy the index file, delete the original and rename the copy.

I know its not really a ‘solution’ but now its magically working ><, with all files / branches intact. If anyone knows why this might have work, do tell.

In my case, pausing dropbox sync solved the issue

I had the same issue on a Mac. It seems to be caused by filesystem ACLs. Try chmod -RN /path/to/repo to clear the ACLs. After doing this I was able to commit changes. Using the trick to copy the index file, delete the original and move the copy back achieved the same result.

If you have your github setup in some sort of online syncing service, such as google drive or dropbox, try disabling the syncing as the syncing service tries to read/write to the file as github tries to do the same, leading to github not working correctly.

Closing Visual Studio Code (that in my case has an auto-uploader background job running on file-save) solved the issue for me.

Credit for the solution: my friend and colleague Arnel.

It happened to me that the file .git/index was in use by another process (my local development web server). I shut down the process and then it worked.

In my case, the solution was only adding permission to the new user.

When I installed new OS, moved my repos around and it was showing this exact error I selected the root folder and then added authenticated the user to check all
enter image description here

This worked for me:

rm -f ./.git/index.lock

I had ACL (somehow) attached to all files in the .git folder.

Check it with ls -le in the .git folder.

You can remove the ACL with chmod -N (for a folder/file) or chmod -RN (recursive)

I think some background backup solutions like Google Backup and Sync block access to the index file. I closed the application and Sourcetree had no issues at all. Seems that Dropbox does the same (@tonymayoral).

The error message fatal: Unable to write new index file means that we could not write the new content to the git index file .gitindex (See here for more information about git index). After reviewing all the answers to this question, I summarize the following root causes:

  • The size of new content exceeds the disk available capacity. (Solution: Clean the disk spaces)
  • Users do not have access right to this file. (Solution: Grant the permission)
  • Users have permission but .gitindex is locked by other users or processes. (Solution: Unlock the file)

The link Find out which process is locking a file or folder in Windows specifies the following approach to find out the process which is locking a specific file:

SysInternals Process Explorer — Go to Find > Find Handle or DLL. In the «Handle or DLL substring:» text box, type the path to the file (e.g. «C:pathtofile.txt») and click «Search». All processes which have an open handle to that file should be listed.

Use the above approach to find which process locked .gitindex and then stop the locking executable. This unlocks .gitindex.

For example, Process Explorer Search shows that .gitindex is locked by vmware-vmx.exe. Suspending the VMWare Player virtual machine (which accessed the git repo via a shared folder) solved the issue.

In my case it was a concurrent running EGit. After restarting eclipse it works as usual.

If you’re on a Windows box, make sure the program you’re using, whether it’s Source Tree or a git terminal, is running as administrator. I was getting the same exact error message. You can either right click on the program to run as administrator or change its properties to always run as administrator.

IF YOU GET THIS DURING A REBASE:

This is most likely caused by some software locking the index file of your repo, such as backup software, anti-viruses, IDEs or other git clients.

In most cases the lock is just for a brief moment and so it just happens out of bad-timing and bad luck.

However, git rebase --continue will complain about the next command being an empty commit:

The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

To fix this, just run git reset and try git rebase --continue again.

Not having enough space is an issue. Cleanup and try again

I had the same problem. I restarted my computer and the issue was resolved.

did you try ‘git add .’ . will it all the changes?
(you can remove unnecessary added files by git reset HEAD )

In my case it was a nodemon instance watching filesystem for changes.

For some reason, doing git add from wsl terminal was working fine. But the sublime merge would always give me this error. Turned out VS code was preventing it somehow. Closing VS code made it work. Someone also solved this problem same way — https://stackoverflow.com/a/47871586/6236710

Issue:
When I was checking out some modified files in git, got this error.
I was having two users ABC and XYZ. files are having uid:gid of ABC but it doesn’t have git access and trying to checkout the files with same.

The solution I have tried:
XYZ is having git access, tried checking out files with sudo and it worked..!!

Here is what worked for me:

Context:

  1. Building a project on a server

  2. git status returns a HEAD detached at <commit-SHA>

  3. What ever operation I did locally, I had this error. More specifically:

    • git checkout
    • git reset HEAD —hard

Solution

  1. Simply removed file <work-dir>/.git/index.
  2. A git status would indicate that all files in the projet are not tracked (no surprise here).
  3. git reset HEAD --hard
  4. Back to HEAD detached at <commit-SHA> when doing a git status, but then you should be able to
  5. git checkout <some-branch>

and you’re back on track!

!! IMPORTANT !!

This works only because I am «merly» building. No precious modification has been performed on the code. If you are actually in «dev-time», then I would recommand to save your work first or go for another method.

Hope it will help :).

I had this problem using GitExtensions on windows. Fixed by granting full permission for the current user (me) on the folder that contained the repo.

Another time, I even though I was getting the error from Git Extensions, I was able to commit the same files from Visual Studio 2015.

Another time I had to delete the «index» file from the .git folder

My case is a bit interesting:

I run git log to check a certain commit, then I didn’t quit it properly, I press ctrl+c to exit it.

Then the index seems been locked. So I run git log again, then press Q to quit it.

Problem fixed. :)

I had/have this problem too. In my case, none of the explanations applied:

  • enough disk room
  • I had sufficient privileges, I can write the index file, I can rename it, I can create it, the workaround did nothing
  • restarting windows didn’t work
  • index not locked by processes

Until I found out that once I accessed the windows folder via another (linux) computer, git worked without complaints. It must have something to do with the git version I use from my normal debian buster computer: git 1.2.20 is giving me the ‘unable to write new index’ error, whereas from a ubuntu fuzzy virtualbox (git 1.2.2) adds the file without problems.

running with sudo worked for me.

for example:
sudo git add -r

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error unable to download json metadata
  • Error unable to access jarfile core jar
  • Error skipping because parent directory has insecure permissions
  • Error unable to access jarfile compiler jar
  • Error size of array is too large

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии