git

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package git contains routines for interacting with git over the CLI. Unlike go-git, this is not a pure go library for interacting with git, and relies on the git command line being available locally. This is meant to provide high level interfaces used throughout various Gruntwork CLIs.

NOTE: The tests for these packages are intentionally stored in a separate test folder, rather than the go converntional style of source_test.go files. This is done to ensure that the tests for the packages are run in a separate docker container, as many functions in this package pollute the global git configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checkout

func Checkout(ref string, targetDir string) error

Checkout checks out the given ref for the repo cloned in the target directory.

func Clone

func Clone(repo string, targetDir string) error

Clone runs git clone to clone the specified repository into the given target directory.

func ConfigureForceHTTPS

func ConfigureForceHTTPS() error

ConfigureForceHTTPS configures git to force usage of https endpoints instead of SSH based endpoints for the three primary VCS platforms (GitHub, GitLab, BitBucket).

func ConfigureHTTPSAuth

func ConfigureHTTPSAuth(gitUsername string, gitOauthToken string, vcsHost string) error

ConfigureHTTPSAuth configures git with username and password to authenticate with the given VCS host when interacting with git over HTTPS. This uses the cache credentials store to configure the credentials. Refer to the git documentation on credentials storage for more information: https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage

Types

type TargetDirectoryNotExistsErr

type TargetDirectoryNotExistsErr struct {
	// contains filtered or unexported fields
}

TargetDirectoryNotExistsErr is returned when the target directory of the git commands does not exist or is not a directory.

func (TargetDirectoryNotExistsErr) Error

func (err TargetDirectoryNotExistsErr) Error() string

Jump to

Keyboard shortcuts

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