Documentation
¶
Index ¶
- func CommitFile(filePath, message string, push bool) error
- func CommitFiles(filePaths []string, message string, push bool) error
- func FindRepoRoot(path string) (string, error)
- func GetSignature(repo *git.Repository) *object.Signature
- func Init(path string) error
- func InitAndCommit(path, message string) error
- func IsGitRepo(path string) bool
- func SSHAuthForRepo(repo *git.Repository) (*ssh.PublicKeys, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitFile ¶
CommitFile stages and commits a single file with the given message. If push is true and remotes exist, it will also push to the remote. Returns nil if the file is not in a git repo.
func CommitFiles ¶
CommitFiles stages and commits multiple files with the given message. If push is true and remotes exist, it will also push to the remote. All files must be in the same repository.
func FindRepoRoot ¶
FindRepoRoot finds the root of the git repository containing the given path
func GetSignature ¶
func GetSignature(repo *git.Repository) *object.Signature
GetSignature returns a git signature using the user's configured git identity. It checks local repo config first, then global config, falling back to defaults.
func InitAndCommit ¶
InitAndCommit initializes a git repository and makes an initial commit
func SSHAuthForRepo ¶ added in v0.10.0
func SSHAuthForRepo(repo *git.Repository) (*ssh.PublicKeys, error)
SSHAuthForRepo reads the repo's remote URL, extracts the hostname, and resolves the correct SSH private key via ~/.ssh/config. Falls back to scanning ~/.ssh/ for any private key if no matching Host entry is found.
Types ¶
This section is empty.