Adding shell function for git mirror. - dotfiles - These are my dotfiles. There are many like it, but these are mine.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 8e19d3ccc47045462676ef5b3499f3b31a761e93
(DIR) parent 1bbe6709f226fc75c75271dd1879f37c6912ca40
(HTM) Author: Jay Scott <me@jay.scot>
Date: Wed, 17 Jul 2024 18:40:13 +0100
Adding shell function for git mirror.
Diffstat:
M ashrc | 11 +++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/ashrc b/ashrc
@@ -54,3 +54,14 @@ export LANG=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
export LC_ALL=en_US.UTF-8
export PS1="\[\e[00;34m\]▶▶▶ \W \[\e[0m\]"
+
+mirror_repo() {
+ if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then
+ remote_url="git@jay.scot:$(basename $(pwd))"
+ git remote add mirror "$remote_url" 2>/dev/null || true
+ git push --mirror mirror
+ echo "Mirrored to $remote_url"
+ else
+ echo "Not a git repository"
+ fi
+}