From d429c0332877659113fcb7e6da55941cdebf708c Mon Sep 17 00:00:00 2001 From: Pascal Breuninger Date: Wed, 22 May 2024 19:22:04 +0200 Subject: [PATCH] fix(cli): git credentials forwarding on vscode with private dotfiles --- cmd/ssh.go | 8 +++++++- cmd/up.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/ssh.go b/cmd/ssh.go index dd11a442a..3b5986f69 100644 --- a/cmd/ssh.go +++ b/cmd/ssh.go @@ -44,7 +44,8 @@ type SSHCmd struct { AgentForwarding bool GPGAgentForwarding bool - StartServices bool + StartServices bool + ForceGitCredentialForwarding bool Proxy bool @@ -93,6 +94,8 @@ func NewSSHCmd(flags *flags.GlobalFlags) *cobra.Command { sshCmd.Flags().BoolVar(&cmd.GPGAgentForwarding, "gpg-agent-forwarding", false, "If true forward the local gpg-agent to the remote machine") sshCmd.Flags().BoolVar(&cmd.Stdio, "stdio", false, "If true will tunnel connection through stdout and stdin") sshCmd.Flags().BoolVar(&cmd.StartServices, "start-services", true, "If false will not start any port-forwarding or git / docker credentials helper") + sshCmd.Flags().BoolVar(&cmd.ForceGitCredentialForwarding, "force-git-credential-forwarding", false, "Forces git credential forwarding") + _ = sshCmd.Flags().MarkHidden("force-git-credential-forwarding") return sshCmd } @@ -420,6 +423,9 @@ func (cmd *SSHCmd) startServices( ) { if cmd.User != "" { gitCredentials := ideName != string(config.IDEVSCode) + if cmd.ForceGitCredentialForwarding { + gitCredentials = true + } err := tunnel.RunInContainer( ctx, devPodConfig, diff --git a/cmd/up.go b/cmd/up.go index b6013cb29..73d8bc0c6 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -883,6 +883,7 @@ func setupDotfiles( "ssh", "--agent-forwarding=true", "--start-services=true", + "--force-git-credential-forwarding", "--user", remoteUser, "--context",