Skip to content

Commit

Permalink
fix: Do not overwrite sshCommand in git config (#3036)
Browse files Browse the repository at this point in the history
To avoid messing with user settings.

Fixes #2994

Signed-off-by: Dominik Schulz <[email protected]>
  • Loading branch information
dominikschulz authored Jan 13, 2025
1 parent b6140bc commit 2c0a1a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/backend/storage/gitfs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ func (g *Git) fixConfig(ctx context.Context) error {

// setup for persistent SSH connections.
if sc := gitSSHCommand(); sc != "" {
if err := g.ConfigSet(ctx, "core.sshCommand", sc); err != nil {
out.Errorf(ctx, "Error while configuring persistent SSH connections: %s", err)
ov, err := g.ConfigGet(ctx, "core.sshCommand")
// only set sshCommand if it's not already set. Avoid overwriting user settings.
if err != nil && ov == "" {
if err := g.ConfigSet(ctx, "core.sshCommand", sc); err != nil {
out.Errorf(ctx, "Error while configuring persistent SSH connections: %s", err)
}
}
}

Expand Down

0 comments on commit 2c0a1a1

Please sign in to comment.