git

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package git contains functions to interact with repos.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSHA1Hash

func CheckSHA1Hash(ref string) bool

CheckSHA1Hash checks if a string is a valid git SHA hash (40 hex characters).

Types

type AuthProvider

type AuthProvider interface {
	GetAuthMethod() (transport.AuthMethod, error)
}

AuthProvider wraps a specific auth method.

type CloneOptions

type CloneOptions struct {
	Repo      string
	RefName   string
	Directory string
	Path      string // Optional path for sparse checkout
}

CloneOptions configure for git actions.

type Cloner

type Cloner interface {
	CloneRepository(store storage.Storer, fs billy.Filesystem, auth AuthProvider, opts CloneOptions) (*plumbing.Reference, error)
}

Cloner can clone git repositories with (optional) authentication.

type CompositeAuthProvider

type CompositeAuthProvider struct {
	Providers []AuthProvider
}

CompositeAuthProvider tries multiple auth providers in order until one succeeds.

func (*CompositeAuthProvider) GetAuthMethod

func (c *CompositeAuthProvider) GetAuthMethod() (transport.AuthMethod, error)

GetAuthMethod returns the first successful auth method.

type DefaultCloner

type DefaultCloner struct{}

DefaultCloner is the default implementation of Cloner.

func (*DefaultCloner) CloneRepository

func (dc *DefaultCloner) CloneRepository(store storage.Storer, fs billy.Filesystem, auth AuthProvider, opts CloneOptions) (*plumbing.Reference, error)

CloneRepository clones a git repository using the provided CloneOptions and AuthProvider.

type HTTPSAuthProvider

type HTTPSAuthProvider struct {
	Username string
	Password string
}

HTTPSAuthProvider provides authentication for HTTPS repositories.

func (*HTTPSAuthProvider) GetAuthMethod

func (a *HTTPSAuthProvider) GetAuthMethod() (transport.AuthMethod, error)

GetAuthMethod returns the HTTP BasicAuth transport method.

type SSHAgentAuthProvider

type SSHAgentAuthProvider struct {
	Username string
}

SSHAgentAuthProvider provides authentication using the SSH agent.

func (*SSHAgentAuthProvider) GetAuthMethod

func (a *SSHAgentAuthProvider) GetAuthMethod() (transport.AuthMethod, error)

GetAuthMethod returns the SSH agent auth method.

type SSHAuthProvider

type SSHAuthProvider struct {
	Username       string
	PrivateKeyPath string
	Passphrase     string
}

SSHAuthProvider provides authentication for SSH repositories.

func (*SSHAuthProvider) GetAuthMethod

func (a *SSHAuthProvider) GetAuthMethod() (transport.AuthMethod, error)

GetAuthMethod returns the SSH PublicKey transport method.

Jump to

Keyboard shortcuts

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