mirror of
https://github.com/harness/drone.git
synced 2025-05-20 19:09:59 +08:00
[GITRPC] Disable Credential Helper For Puhs (#511)
This commit is contained in:
parent
682efb9dba
commit
e88a518da4
@ -193,7 +193,10 @@ func (g Adapter) Push(ctx context.Context, repoPath string, opts types.PushOptio
|
||||
// NOTE: Modification of gitea implementation that supports --force-with-lease.
|
||||
// TODOD: return our own error types and move to above adapter.Push method
|
||||
func Push(ctx context.Context, repoPath string, opts types.PushOptions) error {
|
||||
cmd := gitea.NewCommand(ctx, "push")
|
||||
cmd := gitea.NewCommand(ctx,
|
||||
"-c", "credential.helper=",
|
||||
"push",
|
||||
)
|
||||
if opts.Force {
|
||||
cmd.AddArguments("-f")
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/harness/gitness/gitrpc/internal/gitea"
|
||||
"github.com/harness/gitness/gitrpc/internal/middleware"
|
||||
"github.com/harness/gitness/gitrpc/internal/tempdir"
|
||||
"github.com/harness/gitness/gitrpc/internal/types"
|
||||
@ -327,7 +328,7 @@ func (r *SharedRepo) push(ctx context.Context, writeRequest *rpc.WriteRequest,
|
||||
sourceRef, destinationRef string) error {
|
||||
// Because calls hooks we need to pass in the environment
|
||||
env := CreateEnvironmentForPush(ctx, writeRequest)
|
||||
if err := git.Push(ctx, r.tmpPath, git.PushOptions{
|
||||
if err := gitea.Push(ctx, r.tmpPath, types.PushOptions{
|
||||
Remote: r.remoteRepo.Path,
|
||||
Branch: sourceRef + ":" + destinationRef,
|
||||
Env: env,
|
||||
|
Loading…
Reference in New Issue
Block a user