File tree 1 file changed +15
-12
lines changed
components/content-service/pkg/initializer 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -77,18 +77,21 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping)
77
77
}
78
78
79
79
// make sure that folder itself is owned by gitpod user prior to doing git clone
80
- //args := []string{"gitpod", ws.Location}
81
- //cmd := exec.Command("chown", args...)
82
- //res, cerr := cmd.CombinedOutput()
83
- //if cerr != nil && !process.IsNotChildProcess(cerr) {
84
- // err = git.OpFailedError{
85
- // Args: args,
86
- // ExecErr: cerr,
87
- // Output: string(res),
88
- // Subcommand: "chown",
89
- // }
90
- // return err
91
- //}
80
+ // this is needed as otherwise git clone will fail if the folder is owned by root
81
+ if ws .RunAsGitpodUser {
82
+ args := []string {"gitpod" , ws .Location }
83
+ cmd := exec .Command ("chown" , args ... )
84
+ res , cerr := cmd .CombinedOutput ()
85
+ if cerr != nil && ! process .IsNotChildProcess (cerr ) {
86
+ err = git.OpFailedError {
87
+ Args : args ,
88
+ ExecErr : cerr ,
89
+ Output : string (res ),
90
+ Subcommand : "chown" ,
91
+ }
92
+ return err
93
+ }
94
+ }
92
95
93
96
log .WithField ("stage" , "init" ).WithField ("location" , ws .Location ).Debug ("Running git clone on workspace" )
94
97
err = ws .Clone (ctx )
You can’t perform that action at this time.
0 commit comments