diff --git a/git/git.go b/git/git.go index 50012f49ad4..defeae713ea 100644 --- a/git/git.go +++ b/git/git.go @@ -231,11 +231,12 @@ func CommitBody(sha string) (string, error) { } // Push publishes a git ref to a remote and sets up upstream configuration -func Push(remote string, ref string, cmdOut, cmdErr io.Writer) error { +func Push(remote string, ref string, cmdIn io.ReadCloser, cmdOut, cmdErr io.Writer) error { pushCmd, err := GitCommand("push", "--set-upstream", remote, ref) if err != nil { return err } + pushCmd.Stdin = cmdIn pushCmd.Stdout = cmdOut pushCmd.Stderr = cmdErr return run.PrepareCmd(pushCmd).Run() diff --git a/pkg/cmd/pr/create/create.go b/pkg/cmd/pr/create/create.go index 92deb469d1f..5d3fa416ce0 100644 --- a/pkg/cmd/pr/create/create.go +++ b/pkg/cmd/pr/create/create.go @@ -726,8 +726,9 @@ func handlePush(opts CreateOptions, ctx CreateContext) error { r := NewRegexpWriter(opts.IO.ErrOut, gitPushRegexp, "") defer r.Flush() cmdErr := r + cmdIn := opts.IO.In cmdOut := opts.IO.Out - if err := git.Push(headRemote.Name, fmt.Sprintf("HEAD:%s", ctx.HeadBranch), cmdOut, cmdErr); err != nil { + if err := git.Push(headRemote.Name, fmt.Sprintf("HEAD:%s", ctx.HeadBranch), cmdIn, cmdOut, cmdErr); err != nil { if didForkRepo && pushTries < maxPushTries { pushTries++ // first wait 2 seconds after forking, then 4s, then 6s