gitauth

package
v0.0.0-...-57b1569 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: BSD-3-Clause Imports: 14 Imported by: 9

Documentation

Overview

A Go implementation of https://gerrit.googlesource.com/gcompute-tools/+show/master/git-cookie-authdaemon

Index

Constants

View Source
const (
	REFRESH        = time.Minute
	RETRY_INTERVAL = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitAuth

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

GitAuth continuously updates the git cookie.

func New

func New(ctx context.Context, tokenSource oauth2.TokenSource, filename string, config bool, email string) (*GitAuth, error)

New returns a new *GitAuth.

tokenSource - An oauth2.TokenSource authorized to access the repository, with an appropriate scope set. filename - The name of the git cookie file, e.g. "~/.git-credential-cache/cookie". config - If true then set the http.cookiefile config globally for git and set the user name and email globally if

'email' is not the empty string.

email - The email address of the authorized account. Used to set the git config user.name and user.email. Can be "",

        in which case user.name

	and user.email are not set.

If config is false then Git must be told about the location of the Cookie file, for example:

git config --global http.cookiefile ~/.git-credential-cache/cookie

A goroutine will be started to refresh the token. It will stop when the passed-in context is cancelled.

Jump to

Keyboard shortcuts

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