git
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- func CloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOptions) (bool, error)
- func DecodeBase64PrivateKey(key string) (gossh.Signer, error)
- func LogHostKeyCallback(logger func(string, ...any)) gossh.HostKeyCallback
- func ProgressWriter(write func(line string, args ...any)) io.WriteCloser
- func ReadPrivateKey(path string) (gossh.Signer, error)
- func SetupRepoAuth(logf func(string, ...any), options *options.Options) transport.AuthMethod
- func ShallowCloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOptions) error
- type CloneRepoOptions
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcCloneRepo¶
CloneRepo will clone the repository at the given URL into the given path.If a repository is already initialized at the given path, it will notbe cloned again.
The bool returned states whether the repository was cloned or not.
funcDecodeBase64PrivateKey¶added inv1.0.4
DecodeBase64PrivateKey attempts to decode a base64 encoded privatekey and returns an ssh.Signer
funcLogHostKeyCallback¶
func LogHostKeyCallback(logger func(string, ...any))gossh.HostKeyCallback
LogHostKeyCallback is a HostKeyCallback that just logs host keysand does nothing else.
funcProgressWriter¶
func ProgressWriter(write func(linestring, args ...any))io.WriteCloser
funcReadPrivateKey¶
ReadPrivateKey attempts to read an SSH private key from pathand returns an ssh.Signer.
funcSetupRepoAuth¶
SetupRepoAuth determines the desired AuthMethod based on options.GitURL:
| Git URL format | GIT_USERNAME | GIT_PASSWORD | Auth Method || ------------------------|--------------|--------------|-------------|| https?://host.tld/repo | Not Set | Not Set | None || https?://host.tld/repo | Not Set | Set | HTTP Basic || https?://host.tld/repo | Set | Not Set | HTTP Basic || https?://host.tld/repo | Set | Set | HTTP Basic ||file://path/to/repo | - | - | None || path/to/repo | - | - | None || All other formats | - | - | SSH |
For SSH authentication, the default username is "git" but will honourGIT_USERNAME if set.
If SSH_PRIVATE_KEY_PATH is set, an SSH private key will be read fromthat path and the SSH auth method will be configured with that key.
If SSH_KNOWN_HOSTS is not set, the SSH auth method will be configuredto accept and log all host keys. Otherwise, host key checking will beperformed as usual.
funcShallowCloneRepo¶
ShallowCloneRepo will clone the repository at the given URL into the given pathwith a depth of 1. If the destination folder exists and is not empty, theclone will not be performed.
The bool returned states whether the repository was cloned or not.
Types¶
typeCloneRepoOptions¶
type CloneRepoOptions struct {PathstringStorage billy.FilesystemRepoURLstringRepoAuthtransport.AuthMethodProgresssideband.ProgressInsecureboolSingleBranchboolDepthintCABundle []byteProxyOptionstransport.ProxyOptions}