Suppose that there is a remote Git repository R on a Linux server. R is owned by a user U for which a remote login via SSH is not allowed at all (e.g. root
). Neither password-based nor key-based authentication is available for that user. What is allowed, however, is logging on as a different user and then using su
or sudo
to issue commands as U.
Is it possible to combine these two methods so that Git will use su
or sudo
on the remote server in order to access the repository?
Alternatively, is there another method to access R without changing its access permissions or enabling SSH logins for U?
P.S.: I don't mind having to type passwords manually e.g. at an su
prompt, as long as Git handles the rest.
EDIT:
It seems from the comments that I need to clarify my reason for wanting to do something like this. The files tracked by R are system files that are in use by the server in question - R is not a bare repository. That means that the repository cannot really be moved, not without a lot of trickery.
Getting Git to use sudo
would allow R to be accessed using the same security model that protects these files, rather than through a separate avenue that would have to be configured and synchronized separately.