Skip to content

Commit 0939b21

Browse files
author
Scott Schulthess
committed
invet condition
1 parent 9f4ae0f commit 0939b21

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

git.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@ func (g *GitClient) Init(branch string) error {
8989
if err := g.command("git", "config", "--global", "user.email", "concourse@local").Run(); err != nil {
9090
return fmt.Errorf("failed to configure git email: %s", err)
9191
}
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 {
93100
filePath := "/tmp/git-resource-private-key"
94101
err := ioutil.WriteFile(filePath, []byte(g.PrivateKey), 0600)
95102
if err != nil {
@@ -101,16 +108,6 @@ func (g *GitClient) Init(branch string) error {
101108
if err := g.command("git", "config", "credential.https://github.com.helper", helperStr).Run(); err != nil {
102109
return fmt.Errorf("failed to configure github url: %s", err)
103110
}
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)
114111
}
115112
return nil
116113
}

0 commit comments

Comments
 (0)