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
1 changed files with 8 additions and 3 deletions

View File

@ -25,9 +25,14 @@ 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())
pid = process.Pid()
// 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()