On 8/16/24 22:15, James wrote:
I have a git repo which is on a shared server that I trust and control. Adding a safe.directory does _not_ allow me to use this repo anymore.
james@computer1:~/whatever$ git remote show server2
[remote "server2"] url = ssh://root@server2:/home/someoneelse/whatever/ fetch = +refs/heads/*:refs/remotes/server2/*
I believe that safe.directory only affects repositories hosted on the local filesystem—and not on SSH or HTTP(S) remotes.
I would discourage cloning a user repository with the root user, or running git as root if you can at all avoid it.
Since you already have root access on this system, how difficult would it be to add your SSH key as an authorized_key for someoneelse? Then you could use ssh://someoneelse@server2:/home/someoneelse/whatever/.git as your remote.
You could also share repositories via a simple gatekeeper or forge, like gitolite.
Colin