loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
9.56k stars 349 forks source link

Cannot clone git repositories on Windows hosts #1221

Open endocrimes opened 3 months ago

endocrimes commented 3 months ago

What happened?

When using Windows 10, with git installed via scoop, trying to create a workspace in a remote Kubernetes environment fails during the repository clone step.

[14:13:02] debug Credentials server started...
[14:13:02] debug Create content folder C:\Users\Danielle\.devpod\agent\contexts\default\workspaces\spin-operator\content
[14:13:02] debug Clone Repository
[14:13:02] info Could not create process with command '"C:\Users\Danielle\scoop\apps\git\current\cmd\git.exe"  clone --config "credential.helper=!'C:\Program Files\DevPod\devpod-cli.exe' agent git-credentials --port 13488" https://github.com/spinkube/spin-operator C:\Users\Danielle\.devpod\agent\contexts\default\workspaces\spin-operator\content'.
[14:13:02] error Cloning failed: clone repository: error cloning repository: exit status 1. Trying cloning on local machine and uploading folder
[14:13:02] info Cloning from host and upload folder to server
[14:13:02] debug Error receiving from stream: rpc error: code = Unknown desc = exit status 1
[14:13:02] info EOF
[14:13:02] info cloning local folder
[14:13:02] info github.com/loft-sh/devpod/cmd/agent/workspace.RemoteCloneAndDownload
[14:13:02] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:367
[14:13:02] info github.com/loft-sh/devpod/cmd/agent/workspace.prepareWorkspace
[14:13:02] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:216
[14:13:02] info github.com/loft-sh/devpod/cmd/agent/workspace.initWorkspace
[14:13:02] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:137
[14:13:02] info github.com/loft-sh/devpod/cmd/agent/workspace.(*UpCmd).Run
[14:13:02] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:81
[14:13:02] info github.com/loft-sh/devpod/cmd/agent/workspace.NewUpCmd.func1
[14:13:02] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:53
[14:13:02] info github.com/spf13/cobra.(*Command).execute
[14:13:02] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:983
[14:13:02] info github.com/spf13/cobra.(*Command).ExecuteC
[14:13:02] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:1115
[14:13:02] info github.com/spf13/cobra.(*Command).Execute
[14:13:02] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:1039
[14:13:02] info github.com/loft-sh/devpod/cmd.Execute
[14:13:02] info D:/a/devpod/devpod/cmd/root.go:90
[14:13:02] info main.main
[14:13:02] info D:/a/devpod/devpod/main.go:6
[14:13:02] info runtime.main
[14:13:02] info C:/Users/runneradmin/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.windows-amd64/src/runtime/proc.go:271
[14:13:02] info runtime.goexit
[14:13:02] info C:/Users/runneradmin/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.windows-amd64/src/runtime/asm_amd64.s:1695
[14:13:02] info exit status 1

This is "interesting" because directly executing the command succeeds:

PS C:\Users\Danielle> git clone --config "credential.helper=!'C:\Program Files\DevPod\devpod-cli.exe' agent git-credentials --port 14160" https://github.com/spinkube/spin-operator C:\Users\Danielle\.devpod\agent\contexts\default\workspaces\spin-operator\content
Cloning into 'C:\Users\Danielle\.devpod\agent\contexts\default\workspaces\spin-operator\content'...
remote: Enumerating objects: 2067, done.
remote: Counting objects: 100% (895/895), done.
remote: Compressing objects: 100% (384/384), done.
remote: Total 2067 (delta 691), reused 602 (delta 509), pack-reused 1172 (from 1)
Receiving objects: 100% (2067/2067), 1.27 MiB | 11.64 MiB/s, done.
Resolving deltas: 100% (1225/1225), done.

What did you expect to happen instead?

The repository to clone and the workspace to be successfully created.

How can we reproduce the bug? (as minimally and precisely as possible)

Local Environment:

DevPod Provider:

Anything else we need to know?

pascalbreuninger commented 2 months ago

@endocrimes thanks for reporting this issue, we'll look into it 👍

bkneis commented 1 month ago

@endocrimes Another user reported something similiar in https://github.com/loft-sh/devpod/issues/1250, could you try the fix there and see if that works for you? Simply wrap the call to DevPod Desktop in a shell, something like

#! /usr/bin/env sh

exec $SHELL -c 'exec /Applications/DevPod.app/Contents/MacOS/DevPod'

I think it can't find jetbrains because it does not have access to the correct PATH