I have a local repository which I have cloned to another directory on the same machine.
When I do some changes on the clone and commit and then push I get the following error message
I emphasize again that both the cloned repository from which i do the push and the target repository are local and i have Read/Write access to both.
Rafael@MachineID MINGW64 /i/..path.. /Git Clones/Main_Model_Clone (master)
$ git push
Enumerating objects: 267, done.
Counting objects: 100% (267/267), done.
Delta compression using up to 4 threads
Compressing objects: 100% (146/146), done.
Writing objects: 100% (146/146), 52.46 KiB | 55.00 KiB/s, done.
Total 146 (delta 139), reused 0 (delta 0)
remote: Resolving deltas: 100% (139/139), completed with 120 local objects.
error: unable to write file ./objects/pack/pack-299a7ef5ff8b23d37057bcedcfe27a1f0d45d540.idx: Permission denied
To file://i:/ .. path .. /Main_Model
! [remote rejected] master -> master (unable to migrate objects to permanent storage)
error: failed to push some refs to 'file://i:/ .. path .. /Main_Model'
Having encountered this post What does git mean by, "unable to migrate objects to permanent storage"?
I understand i have a permission problem on the remote local repository so i check the files on the local remote directory : .git/objects/pack and indeed one file is readonly
Rafael@MachineID MINGW64 /i/.. path .. /Main_Model/.git/objects/pack (GIT_DIR!)
$ ls -l
total 1580
-rw-r--r-- 1 udoai14 1049089 8520 מרץ 5 11:41 pack-299a7ef5ff8b23d37057bcedcfe27a1f0d45d540.idx
-r--r--r-- 1 udoai14 1049089 1604176 מרץ 5 13:19 pack-299a7ef5ff8b23d37057bcedcfe27a1f0d45d540.pack
but executing chmod -R g+w * on the objects folder as suggested in the first answer comment doesn't help because on the next push the file changes back from rw to r-
i also tried
git config core.sharedRepository true like in this post
but pushing again yields the same error
It appears i had a branch with two stashes in the local remote to which i tried to push.
Deleting the branch with git branch -d
and deleting the stashes with git stash list and git stash drop
Solved the problem