From a81d9bb06eb4ca62747efbfe5d32c0f4e64fc792 Mon Sep 17 00:00:00 2001 From: cashmere Date: Thu, 26 Feb 2026 19:53:00 +0100 Subject: add my/setup-git-remote: dual-push remote setup for dev.cashmere.rs + sr.ht --- config.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'config.el') diff --git a/config.el b/config.el index bf4162b..0217170 100644 --- a/config.el +++ b/config.el @@ -986,6 +986,25 @@ Copies the resulting URL to the kill ring and clipboard." (interactive) (my/snip-upload (read-file-name "Upload to snips.sh: "))) +(defun my/setup-git-remote (dev-name srht-name) + "Set up origin (dual-push) and backup remotes for the current git repo. +DEV-NAME is the repo name on dev.cashmere.rs, SRHT-NAME on sr.ht." + (interactive + (let* ((dev (read-string "Repo name (dev.cashmere.rs): ")) + (srht (read-string (format "Repo name (sr.ht) [%s]: " dev) nil nil dev))) + (list dev srht))) + (let* ((root (or (locate-dominating-file default-directory ".git") + (error "Not in a git repository"))) + (default-directory root) + (dev-url (format "ssh://git@dev.cashmere.rs/cashmere/%s" dev-name)) + (srht-url (format "git@git.sr.ht:~cashmere/%s" srht-name))) + (shell-command (format "git remote remove origin 2>/dev/null; git remote add origin %s" dev-url)) + (shell-command (format "git remote set-url --add --push origin %s" dev-url)) + (shell-command (format "git remote set-url --add --push origin %s" srht-url)) + (shell-command (format "git remote remove backup 2>/dev/null; git remote add backup %s" srht-url)) + (message "Remotes configured:\n origin -> %s (push to both)\n backup -> %s" + dev-url srht-url))) + (defun my/paste-md-to-org () "Yank Markdown text as Org. -- cgit v1.3.1