diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-10-13 21:47:32 -0400 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-10-13 21:47:32 -0400 |
commit | f7f203fe9f2e03396824e30e8da30cbbe55b71d7 (patch) | |
tree | 1110639c492f2d54fc5eae5070f3d1c90fdec374 | |
parent | 287ba0a83e7c99ec48ef41279410b5937c8c2e65 (diff) |
add clone-all-github
-rwxr-xr-x | bash | 2 | ||||
-rwxr-xr-x | clone | 2 | ||||
-rwxr-xr-x | clone-all-github | 24 | ||||
-rwxr-xr-x | desc | 2 | ||||
-rwxr-xr-x | help | 2 | ||||
-rwxr-xr-x | init | 2 | ||||
-rwxr-xr-x | ls | 2 | ||||
-rwxr-xr-x | rm | 2 |
8 files changed, 31 insertions, 7 deletions
@@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash bash @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ $# -ne 1 ]; then echo "usage: clone <name>" diff --git a/clone-all-github b/clone-all-github new file mode 100755 index 0000000..ebdeb78 --- /dev/null +++ b/clone-all-github @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +USER=compromyse +REPOS=$(curl https://api.github.com/users/$USER/repos 2>/dev/null | jq -r '.[0].name') + +for rawname in $REPOS; do + repo=$rawname.git + + if [ ! -d $HOME/$repo ]; then + + git clone --bare https://github.com/$USER/$repo $HOME/$repo + + pushd $HOME/$repo > /dev/null + + for remote in $(git remote show); do + git remote remove $remote + git remote add github git@github.com:$USER/$repo + git fetch github + done + + popd > /dev/null + + fi +done @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ $# -ne 1 ]; then echo "usage: desc <name>" @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash echo """Welcome to git-shell on $(uname -n)! @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ $# -ne 1 ]; then echo "usage: init <name>" @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash find "$HOME" -maxdepth 1 -type d -name '*\.git' -printf "%f\n" @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ $# -ne 1 ]; then echo "usage: rm <name>" |