After `su user`, getting `fatal: failed to stat : Permission denied` with `git push`
0
votes
1
answer
922
views
There's a lot of **setup** for this question:
I've got a host (
rpi5.local
) with 2 user accounts: pi
and cake
.
I wanted to explore git
, and I created the cake
account to "own" the "server/origin" repos. As user cake
, in /home/cake
, I created a folder (git-srv
) with a sub-folder called projectA
. I went through the process of initializing this repo using git init --bare
.
Initially, I "populated" the projectA
repo on the server from another host (rpi4b.local
). I push
ed some files in a folder called Aproject
on the raspberrypi4b.local
host to the projectA
repo via SSH using this sequence:
$ hostname
rpi4b.local
$ pwd
/home/pi/Aproject
$ git push -u ssh://git@rpi5.local/home/cake/git-srv/projectA.git
This worked fine.
As user pi
, I clone
d the projectA
repo to a folder in /home/pi/XYZ
. I made & commit
ed some changes to one of the files in /home/pi/XYZ
, and attempted to push
those changes to the server as follows:
$ hostname
rpi5.local
$ pwd
/home/pi/XYZ
$ git push -u /home/cake/git-srv/projectA.git
I got an error from this effort:
...
error: remote unpack failed: unable to create temporary object directory
To /home/cake/git-srv/projectA.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/home/cake/projectA.git'
After a bit of research on this error, I concluded it was a *permissions* issue between pi
and cake
. I *figured* the solution would be to su cake
as user pi
, and so I did that, and tried the push
again. And finally, my question:
$ whoami
cake
$ hostname
rpi5.local
$ pwd
/home/pi/XYZ
$ git push -u /home/cake/git-srv/projectA.git
fatal: failed to stat '/home/pi/motd.git': Permission denied
What does failed to stat
mean in this situation, and is there a straightforward *work-around*?
Asked by Seamus
(3772 rep)
Dec 15, 2023, 10:22 AM
Last activity: Dec 15, 2023, 01:09 PM
Last activity: Dec 15, 2023, 01:09 PM