Help us shape the future of Go! Take the 2026 Go Developer Survey

gitconfig

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package gitconfig carries the git identity of the host into the VM.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLogin = errors.New("git on this machine has no login for it")

ErrNoLogin is a remote git on the host has no login for.

View Source
var ErrNoSSHKey = errors.New("this machine has no SSH key for it that aibox can use, in the SSH agent or in a key file without a passphrase")

ErrNoSSHKey is a server for which the host has no SSH key aibox can use without asking: none in the agent, and none of the key files ssh would try that needs no passphrase.

View Source
var ErrProxy = errors.New("the ssh config reaches it with ProxyJump or ProxyCommand, which aibox does not do")

ErrProxy is a host the ssh config reaches through another host or a command, which aibox cannot do.

View Source
var ErrUnknownHost = errors.New("the server is not in the known hosts of this machine, connect once with ssh to add it")

ErrUnknownHost is a server that is not in the known hosts of the host.

Functions

func HostKeyAlgorithms added in v1.4.0

func HostKeyAlgorithms(known ssh.HostKeyCallback, address string) ([]string, error)

HostKeyAlgorithms returns the algorithms of the keys the known hosts hold for the address, so that the server is asked for one of those and not for a type the known hosts do not hold.

func NewHostKeyCheck added in v1.4.0

func NewHostKeyCheck(known ssh.HostKeyCallback) ssh.HostKeyCallback

NewHostKeyCheck returns the check of the known hosts that says what is wrong with the key of a server in words the person can act on.

Types

type Identity

type Identity struct {
	Name  string
	Email string
}

Identity is the name and email git uses for commits.

func Read

func Read(dir string, command func(name string, args ...string) *exec.Cmd) Identity

Read returns the identity git uses for commits in dir on the host, or an empty one when git has none or is not installed. command makes the command that runs git, as exec.Command does.

type Login added in v1.4.0

type Login struct {
	Username string
	Password string
}

Login is the user name and password, or token, git on the host uses for a remote.

func LoginFor added in v1.4.0

func LoginFor(ctx context.Context, remote string) (Login, error)

LoginFor asks git on the host for its login for the HTTPS remote, given as host/path, as git push would. It runs outside any repository, so the config of a project, which the VM can write, has no say, and never asks on the terminal.

type SSHKeys added in v1.4.0

type SSHKeys struct {
	// Config is the ssh config file, or empty for the one ssh reads.
	Config string
	// contains filtered or unexported fields
}

SSHKeys find how the host reaches a server over SSH, as ssh would. They are used before the VM starts, since aibox can open no files once it is confined. The keys of an agent go through a connection to it that stays open until Close.

func LoadSSHKeys added in v1.4.0

func LoadSSHKeys() (*SSHKeys, error)

LoadSSHKeys returns the SSH keys of the host, which reach agents and read files only when asked For a host.

func (*SSHKeys) Close added in v1.4.0

func (k *SSHKeys) Close()

Close closes the connections to the agents.

func (*SSHKeys) For added in v1.4.0

func (k *SSHKeys) For(ctx context.Context, host string) (SSHTarget, error)

For returns how ssh would reach the host: the host name, port, user, agent and known hosts of the ssh config, and the keys it would offer, of those that need no passphrase or are in the agent.

type SSHTarget added in v1.4.0

type SSHTarget struct {
	// Address is the host name and port to dial, which the ssh config
	// may change.
	Address string
	User    string
	Signers []ssh.Signer
	// HostKey checks the key of the server and says what is wrong with it.
	HostKey ssh.HostKeyCallback
	// HostKeyAlgorithms are those of the keys the known hosts hold for the
	// server.
	HostKeyAlgorithms []string
	// Keys name the keys, for the person to see which ones aibox uses.
	Keys []string
}

SSHTarget is how aibox reaches a server over SSH, as ssh would.

Jump to

Keyboard shortcuts

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