Files
mgsh/mgshrc.example
T
mikeandClaude Opus 5 2a622046f2 Define mirror targets one way: remote.<name>.<field>
There were two spellings for the same thing -- a flat
remoteurl/remotekey/remotetype/remotevisibility set for a single server,
and remote.<name>.* blocks for several. The flat one is gone; every
target, including a lone one, is now a named block with the fields url,
key, type and visibility.

An existing ~/.mgshrc is converted on the next start. Only the key is
rewritten, so values, comments, alignment, commented-out lines and the
file's 0600 mode survive untouched, and mgsh prints each rename rather
than doing it quietly. The target is named "public", which is what the
old settings called the git remote they created, so a converted setup
keeps pushing to the same place under the same remote name. A file that
carries both spellings keeps what the new one says.

The environment follows the same shape: MGSH_REMOTEURL and friends are
replaced by MGSH_REMOTE_<NAME>_<FIELD>, so MGSH_REMOTE_GITLAB_KEY sets
remote.gitlab.key. The field is read from the end of the variable name,
which leaves target names free to contain underscores.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 18:00:26 +02:00

67 lines
2.5 KiB
Plaintext

# Example mgsh configuration. mgsh writes a blank ~/.mgshrc on first run; fill
# in the required settings (mgsh refuses to start until they are set). This file
# is just an annotated reference.
#
# Simple "key = value" (or "key: value") lines; a '#' after whitespace starts a
# comment. There are no built-in defaults. Settings are resolved in this order,
# each step overriding the one before:
#
# ~/.mgshrc -> <project>/.mgshrc -> MGSH_* environment variables
# --- required ---
base = /Users/me/src
githost = git.example.com
gitport = 22
gituser = git
gitpath = /home/git
# --- optional ---
# gitkey = mgit_rsa
# gitname = Your Name
# gitemail = you@example.com
# pushdefault = matching
# editor = code
# --- pushremote: mirror to public servers (gitea/github/gitlab) via their API ---
# One "remote.<name>.<field>" block per server, with the fields url, key, type
# and visibility. <name> is yours to pick and becomes the git remote created in
# the repository, so `git push gitlab` keeps working outside mgsh.
#
# `pushremote` pushes to every configured server in the order given,
# `pushremote @gitlab` to a single one.
#
# remote.gitea.url = https://git.example.com
# remote.gitea.key = <personal-access-token>
# remote.gitea.type = gitea # optional; auto-detected from the url
# remote.gitea.visibility = private # or public (default private)
#
# remote.gitlab.url = https://gitlab.example.com
# remote.gitlab.key = <personal-access-token>
# remote.gitlab.type = gitlab
# remote.gitlab.visibility = public
#
# remotes = gitea, gitlab # optional: restrict and order the set
# mirror = true # `push` also mirrors via pushremote
# --- safety ---
# `push` checks the staged diff for private keys and API tokens before it
# commits, and asks before continuing. Only an explicit "off" disables it.
# secretscan = off
# --- per-project overrides ---
# A <project>/.mgshrc overrides all of the above for that project only, except
# base, gitname, gitemail and pushdefault, which stay global. Typical use:
#
# # ~/src/myproject/.mgshrc
# remotes = hub # this project is mirrored to github only
# mirror = true
#
# Keep tokens out of a project .mgshrc unless it is git-ignored — mgsh warns
# when it is not.
# Aliases live in the same file (managed by the `alias` command). The expansion
# is a mgsh command line; $1..$N and $*/$@ expand arguments, and a shell command
# needs a leading '!'.
alias co 'checkout $1'
alias ec '!echo $1'