-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4056 from thinkyhead/rc_mfinit
Script to init the upstream remote for Marlin
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# ghtp (GitHub Transport Protocol) | ||
# | ||
# Set all remotes in the current repo to HTTPS or SSH connection. | ||
# Useful when switching environments, using public wifi, etc. | ||
# | ||
|
||
GH_SSH="git@github\.com:" | ||
GH_HTTPS="https:\/\/github\.com\/" | ||
|
||
case "$1" in | ||
-[Hh]) TYPE=HTTPS ; MATCH="git@" ; FORMULA="$GH_SSH/$GH_HTTPS" ;; | ||
-[Ss]) TYPE=SSH ; MATCH="https:" ; FORMULA="$GH_HTTPS/$GH_SSH" ;; | ||
*) | ||
echo "Usage: `basename $0` -h | -s" 1>&2 | ||
echo -e " \e[0;92m-h\e[0m to switch to HTTPS" 1>&2 | ||
echo -e " \e[0;92m-s\e[0m to switch to SSH" 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
REMOTES=$(git remote -v | egrep "\t$MATCH" | gawk '{print $1 " " $2}' | sort -u | sed "s/$FORMULA/") | ||
|
||
if [[ -z $REMOTES ]]; then | ||
echo "Nothing to do." ; exit | ||
fi | ||
|
||
echo "$REMOTES" | xargs -n2 git remote set-url | ||
|
||
echo -n "Remotes set to $TYPE: " | ||
echo "$REMOTES" | gawk '{printf "%s ", $1}' | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# mfinit | ||
# | ||
# Create the upstream repository for Marlin | ||
# | ||
|
||
git remote add upstream [email protected]:MarlinFirmware/Marlin.git |