.gitignore: Permission denied

error: unable to unlink old '.gitignore': Permission denied

met@mail:~/web/met.k.ua$ git status
On branch test
Your branch is up to date with 'origin/test'.

nothing to commit, working tree clean


met@mail:~/web/met.k.ua$ git branch
  prod
* test


met@mail:~/web/met.k.ua$ git switch prod
error: unable to unlink old '.gitignore': Permission denied
M	.gitignore
Switched to branch 'prod'
Your branch is ahead of 'origin/prod' by 36 commits.
  (use "git push" to publish your local commits)


met@mail:~/web/met.k.ua$ git merge test
error: Your local changes to the following files would be overwritten by merge:
	.gitignore
Please commit your changes or stash them before you merge.
Aborting


met@mail:~/web/met.k.ua$ git switch test
error: Your local changes to the following files would be overwritten by checkout:
	.gitignore
Please commit your changes or stash them before you switch branches.
Aborting


met@mail:~/web/met.k.ua$ git status
On branch prod
Your branch is ahead of 'origin/prod' by 36 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   .gitignore

no changes added to commit (use "git add" and/or "git commit -a")


met@mail:~/web/met.k.ua$ git restore .gitignore
error: unable to unlink old '.gitignore': Permission denied


met@mail:~/web/met.k.ua$ git status
On branch prod
Your branch is ahead of 'origin/prod' by 36 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   .gitignore

no changes added to commit (use "git add" and/or "git commit -a")


met@mail:~/web/met.k.ua$ git add .gitignore


met@mail:~/web/met.k.ua$ git commit -m "gitignore"
[prod 2f96b5f] gitignore
 1 file changed, 1 insertion(+)


met@mail:~/web/met.k.ua$ git merge test

...


met@mail:~/web/met.k.ua$ git status
On branch prod
Your branch is ahead of 'origin/prod' by 71 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Last updated