@@ -89,7 +89,14 @@ func (g *GitClient) Init(branch string) error {
89
89
if err := g .command ("git" , "config" , "--global" , "user.email" , "concourse@local" ).Run (); err != nil {
90
90
return fmt .Errorf ("failed to configure git email: %s" , err )
91
91
}
92
- if g .UseGithubApp {
92
+ if err := g .command ("git" , "config" , "--global" , "url.https://.insteadOf" , "git://" ).Run (); err != nil {
93
+ return fmt .Errorf ("failed to configure github url: %s" , err )
94
+ }
95
+ if ! g .UseGithubApp {
96
+ if err := g .
command (
"git" ,
"config" ,
"url.https://[email protected] /.insteadOf" ,
"[email protected] :" ).
Run ();
err != nil {
97
+ return fmt .Errorf ("failed to configure github url: %s" , err )
98
+ }
99
+ } else {
93
100
filePath := "/tmp/git-resource-private-key"
94
101
err := ioutil .WriteFile (filePath , []byte (g .PrivateKey ), 0600 )
95
102
if err != nil {
@@ -101,16 +108,6 @@ func (g *GitClient) Init(branch string) error {
101
108
if err := g .command ("git" , "config" , "credential.https://github.com.helper" , helperStr ).Run (); err != nil {
102
109
return fmt .Errorf ("failed to configure github url: %s" , err )
103
110
}
104
- } else {
105
- if err := g .
command (
"git" ,
"config" ,
"url.https://[email protected] /.insteadOf" ,
"[email protected] :" ).
Run ();
err != nil {
106
- return fmt .Errorf ("failed to configure github url: %s" , err )
107
- }
108
- }
109
- if err := g .
command (
"git" ,
"config" ,
"--global" ,
"url.https://[email protected] /.insteadOf" ,
"[email protected] :" ).
Run ();
err != nil {
110
- return fmt .Errorf ("failed to configure github url: %s" , err )
111
- }
112
- if err := g .command ("git" , "config" , "--global" , "url.https://.insteadOf" , "git://" ).Run (); err != nil {
113
- return fmt .Errorf ("failed to configure github url: %s" , err )
114
111
}
115
112
return nil
116
113
}
0 commit comments