Fix git push systemauth

This commit is contained in:
Bernd Schoolmann 2023-09-19 22:27:03 +02:00
parent 5a64d08022
commit 5e3f33c076
No known key found for this signature in database

View File

@ -25,10 +25,15 @@ func GetCallingContext(connection net.Conn) CallingContext {
}
pid, _ := creds.PID()
process, err := gops.FindProcess(pid)
if process.Executable() == "ssh-keygen" {
process, err = gops.FindProcess(process.PPid())
// git is epheremal and spawns ssh-keygen and ssh so we need to anchor to git
if process.Executable() == "ssh-keygen" || process.Executable() == "ssh" {
p, e := gops.FindProcess(process.PPid())
if p.Executable() == "git" && e == nil {
process, err = p, e
pid = process.Pid()
}
}
uid, _ := creds.UserID()
ppid := process.PPid()