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.org | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'config.org') diff --git a/config.org b/config.org index a9292d6..d2ad742 100644 --- a/config.org +++ b/config.org @@ -1171,6 +1171,33 @@ Copies the resulting URL to the kill ring and clipboard." (my/snip-upload (read-file-name "Upload to snips.sh: "))) #+end_src +** my/setup-git-remote + +Set up dual-push git remotes for the current repository. Prompts for +the repo name on dev.cashmere.rs and sr.ht, then configures origin to +push to both servers. sr.ht auto-creates repos on first push. + +#+begin_src emacs-lisp +(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))) +#+end_src + ** my/paste-md-to-org [[http://yummymelon.com/devnull/import-markdown-to-org-with-the-clipboard-in-emacs.html][nfdn: Import Markdown to Org with the Clipboard in Emacs]] -- cgit v1.3.1