gitmirror

package module
v0.0.0-...-827f7e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

README

gitmirror

Documentation

Index

Constants

View Source
const (
	VisibilityPrivate  = "private"
	VisibilityInternal = "internal"
	VisibilityPublic   = "public"
)

Variables

View Source
var (
	ErrGitRepositorySetURL = errors.New("string interpretation failed")
)

Functions

func FileExist

func FileExist(filename string) bool

func ForkRepository

func ForkRepository(form *GitRepository, to *GitRepository) error

ForkRepository gr := &gitmirror.GitRepository{} gr.SetHub(&githubm.Hub{Username: "username", Password: "ghp_**************"}) gr.SetURL("https://github.com/pkg6/gitmirror.git") gitmirror.ForkRepository(gr,nil)

func GitAuthWithBasic

func GitAuthWithBasic(account, password string) transport.AuthMethod

func GitAuthWithDefaultPublicKeysFromFile

func GitAuthWithDefaultPublicKeysFromFile(password string) transport.AuthMethod

func GitAuthWithPublicKeysFromFile

func GitAuthWithPublicKeysFromFile(pemFile, password string) transport.AuthMethod

func MigrateRepository

func MigrateRepository(form *GitRepository, to *GitRepository) error

func MirrorPushRepository

func MirrorPushRepository(form *GitRepository, to *GitRepository) error

MirrorPushRepository form := &gitmirror.GitRepository{} form.SetURL("https://github.com/pkg6/gitmirror.git") h := &githubm.Hub{Username: "username", Password: "ghp_****************"} to := &gitmirror.GitRepository{} to.SetHub(h) to.SetBasicAuth("account", "ghp_****************") || to.SetDefaultPublicKeys("") to.SetURL("git@github.com:you/gitmirror.git") gitmirror.MirrorPushRepository(form, to)

func SimpleForkRepository

func SimpleForkRepository(hub IHub, repositoryURL string) error

func SimpleMirrorPushRepository

func SimpleMirrorPushRepository(formRepositoryURL, toRepositoryURL string, toHub IHub, auth transport.AuthMethod) error

Types

type GitRepository

type GitRepository struct {
	// IHub
	Hub IHub
	// pull push auth
	Auth transport.AuthMethod

	//true git@github.com:pkg6/gitmirror.git
	//false https://github.com/pkg6/gitmirror.git
	IsSSL bool
	//exp:
	//git@github.com:pkg6/git-mirror.git
	//https://github.com/pkg6/gitmirror.git
	RepositoryURL string
	//exp: pkg6
	OwnerOrOrg string
	//exp:git-mirror
	RepositoryName string
	//Edit repository details->Description
	Description string
	//Edit repository details->Website
	Homepage string
	//private | internal |public
	Visibility string
	//exp: pwd/git-mirror
	LocalPath string
	// contains filtered or unexported fields
}

func (*GitRepository) Fork

func (r *GitRepository) Fork(dst *GitRepository) error

func (*GitRepository) GetLocalPath

func (r *GitRepository) GetLocalPath() string

func (*GitRepository) Mirror

func (r *GitRepository) Mirror() error

Mirror git remote add mirror RepositoryURL git config --add remote.mirror.mirror true

func (*GitRepository) MirrorClone

func (r *GitRepository) MirrorClone() error

MirrorClone git clone --mirror RepositoryURL LocalPath

func (*GitRepository) MirrorPush

func (r *GitRepository) MirrorPush() error

MirrorPush git push --mirror

func (*GitRepository) Open

func (r *GitRepository) Open() error

Open cd Name

func (*GitRepository) SetAuth

func (r *GitRepository) SetAuth(auth transport.AuthMethod) *GitRepository

func (*GitRepository) SetBasicAuth

func (r *GitRepository) SetBasicAuth(account, password string)

func (*GitRepository) SetDefaultPublicKeys

func (r *GitRepository) SetDefaultPublicKeys(password string)

func (*GitRepository) SetHub

func (r *GitRepository) SetHub(hub IHub)

func (*GitRepository) SetPublicKeys

func (r *GitRepository) SetPublicKeys(pemFile, password string)

func (*GitRepository) SetURL

func (r *GitRepository) SetURL(repositoryURL string) error

func (*GitRepository) URL

func (r *GitRepository) URL() string

type IHub

type IHub interface {
	SetAccount(account string)
	SetPassword(password string)
	Domain() string
	RepositoryExist(repository *GitRepository) bool
	RepositoryCreate(repository *GitRepository) error
	RepositoryFork(form *GitRepository, to *GitRepository) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL