0

While I try to execute any git command like:

git checkout -- project-folder/home.php

or,

git add project-folder/home.php

shows error as following:

fatal: Unable to create '/project-folder/.git/index.lock': Read-only file system

What is the solution?

Shah Alom
  • 1,031
  • 1
  • 14
  • 26
  • Possible duplicate of [Git - fatal: Unable to create '/path/my\_project/.git/index.lock': File exists](https://stackoverflow.com/questions/7860751/git-fatal-unable-to-create-path-my-project-git-index-lock-file-exists) – Francesco Aug 22 '17 at 19:07
  • `Read-only file system` means just what it says it means: all the files on this file system can be read, but no file can be written, no new file can be created, no file can be deleted. For Git to check out a branch or some files, it must write some files. Since no files can be written or created, you cannot use this repository this way in this location. – torek Aug 22 '17 at 19:19

2 Answers2

2

The scenario is I was connected to a git client virtual machine (VM) through a VPN connection. After working for an hour suddenly the VM down because of power loss.

In the mean time, I was trying to execute the git commands which result from the error. Because my commands were not able to access the system, return "Read-only file system" error.

Shah Alom
  • 1,031
  • 1
  • 14
  • 26
-1

I know it's been a moment but just in case anyone else end upd there, try:

sudo rw

In the main directory of the git repo

Max Alonzo
  • 45
  • 5