Skip to content

Commit

Permalink
fix(cli): git credentials forwarding on vscode with private dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbreuninger committed May 22, 2024
1 parent 05dd69c commit f752e4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ type SSHCmd struct {
AgentForwarding bool
GPGAgentForwarding bool

StartServices bool
StartServices bool
ForceGitCredentialForwarding bool

Proxy bool

Expand Down Expand Up @@ -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")

Check failure on line 98 in cmd/ssh.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `(*github.com/spf13/pflag.FlagSet).MarkHidden` is not checked (errcheck)
return sshCmd
}

Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ func setupDotfiles(
"ssh",
"--agent-forwarding=true",
"--start-services=true",
"--force-git-credential-forwarding",
"--user",
remoteUser,
"--context",
Expand Down

0 comments on commit f752e4a

Please sign in to comment.