Slice 8: configure git credentials + identity in the container
On startup the app runs git config --global to set a commit identity (GIT_USER_NAME/GIT_USER_EMAIL), safe.directory=* for host-owned mounts, and http.<GITEA_URL>.extraheader with the Gitea token so push/fetch/pull authenticate over HTTPS without an SSH key. New git.CLI.SetGlobalConfig and config fields. Verified: fetch via the app works and the identity/header are set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,13 @@ func (c *CLI) Version(ctx context.Context) (string, error) {
|
||||
return c.run(ctx, "", "version")
|
||||
}
|
||||
|
||||
// SetGlobalConfig sets a global git config value (git config --global key value).
|
||||
// Used at startup to give the container git a commit identity and remote auth.
|
||||
func (c *CLI) SetGlobalConfig(ctx context.Context, key, value string) error {
|
||||
_, err := c.run(ctx, "", "config", "--global", key, value)
|
||||
return err
|
||||
}
|
||||
|
||||
// CurrentBranch returns the checked-out branch, or "HEAD" when detached.
|
||||
func (c *CLI) CurrentBranch(ctx context.Context, dir string) (string, error) {
|
||||
return c.run(ctx, dir, "rev-parse", "--abbrev-ref", "HEAD")
|
||||
|
||||
Reference in New Issue
Block a user