@@ -4,13 +4,14 @@ import (
44 "context"
55 "crypto/rsa"
66 "fmt"
7+ "net/http"
8+ "os"
9+
710 "github.com/actiontech/dms/pkg/dms-common/dmsobject"
811 "github.com/actiontech/sqle/sqle/errors"
912 "github.com/actiontech/sqle/sqle/utils"
1013 "github.com/go-git/go-git/v5/config"
1114 "github.com/go-git/go-git/v5/plumbing"
12- "net/http"
13- "os"
1415
1516 "github.com/actiontech/sqle/sqle/api/controller"
1617 "github.com/actiontech/sqle/sqle/dms"
@@ -419,7 +420,7 @@ func getGitAuthMethod(url, username, password string) (transport.AuthMethod, err
419420 if err != nil {
420421 return nil , err
421422 }
422- if systemVariable .Data .SystemVariableSSHPrimaryKey ! = "" {
423+ if systemVariable .Data .SystemVariableSSHPrimaryKey = = "" {
423424 return nil , errors .New (errors .DataNotExist , fmt .Errorf ("git ssh private key not found" ))
424425 }
425426 publicKeys , err := sshTransport .NewPublicKeys ("git" , []byte (systemVariable .Data .SystemVariableSSHPrimaryKey ), "" )
@@ -449,7 +450,8 @@ func ListGitBranches(ctx context.Context, url, username, password string) ([]str
449450
450451 // 获取远程引用(包括分支和标签)
451452 refs , err := remote .List (& git.ListOptions {
452- Auth : auth ,
453+ Auth : auth ,
454+ InsecureSkipTLS : true , // 跳过 SSL 证书验证,支持自签名证书
453455 })
454456 if err != nil {
455457 return nil , err
@@ -476,7 +478,8 @@ func CloneGitRepository(ctx context.Context, url, username, password, branch str
476478 }
477479
478480 cloneOpts := & git.CloneOptions {
479- URL : url ,
481+ URL : url ,
482+ InsecureSkipTLS : true , // 跳过 SSL 证书验证,支持自签名证书
480483 }
481484 if branch != "" {
482485 cloneOpts .ReferenceName = plumbing .ReferenceName (branch )
0 commit comments