Closed jefshe closed 3 years ago
Does it work if you just switch to the new user first? I don't understand why a user wouldn't have permission to read their own git config files?
As a workaround maybe you can try this:
install.packages("credentials", INSTALL_opts="--no-test-load")
Thanks for the fast response jeroen
Does it work if you just switch to the new user first?
yep
I don't understand why a user wouldn't have permission to read their own git config files?
Running this command from the command line results in the same behaviour
sudo -u otheruser git config --global credential.helper cache
error: could not lock config file /home/currentuser/.gitconfig: Permission denied
I guess git looks at the HOME variable to figure out where your git config file is.
running sudo with -H
flag seems to resolve the problem too. So i'll close this out
I'm trying to install this package on a system for another user:
echo 'install.packages("credentials")' | sudo -u some_other_user R --no-save
This causes the following error to occur:
I see that the error is occurring here where we set the global user git config to cache credentials: https://github.com/r-lib/credentials/blob/master/R/onattach.R#L22.
I can see it being useful to have this behaviour for the common user but I don't think it's necessarily desirable all the time. Could a flag be added to disable this behaviour?