github-origin-https-to-ssh
Advanced tools
Sorry, the diff of this file is not supported yet
+21
| The MIT License (MIT) | ||
| Copyright (c) Richard Littauer <richard.littauer@gmail.com> (burntfen.com) | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
@@ -5,2 +5,8 @@ #!/usr/bin/env bash | ||
| GIT_DOMAIN='github.com' | ||
| if [ $# -eq 1 ] | ||
| then | ||
| GIT_DOMAIN=$1 | ||
| fi | ||
| REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'` | ||
@@ -15,3 +21,4 @@ if [ -z "$REPO_URL" ]; then | ||
| USER=`echo $REPO_URL | sed -Ene's#https://github.com/([^/]*)/(.*).*#\1#p'` | ||
| USER=`echo $REPO_URL | sed -Ene's#https://'$GIT_DOMAIN'/([^/]*)/(.*).*#\1#p'` | ||
| if [ -z "$USER" ]; then | ||
@@ -22,3 +29,3 @@ echo "-- ERROR: Could not identify User." | ||
| REPO=`echo $REPO_URL | sed -Ene's#https://github.com/([^/]*)/(.*).*#\2#p'` | ||
| REPO=`echo $REPO_URL | sed -Ene's#https://'$GIT_DOMAIN'/([^/]*)/(.*).*#\2#p'` | ||
| if [ -z "$REPO" ]; then | ||
@@ -29,3 +36,3 @@ echo "-- ERROR: Could not identify Repo." | ||
| NEW_URL="git@github.com:$USER/$REPO.git" | ||
| NEW_URL="git@$GIT_DOMAIN:$USER/$REPO.git" | ||
| echo "Changing repo url from " | ||
@@ -32,0 +39,0 @@ echo " '$REPO_URL'" |
+3
-3
| { | ||
| "name": "github-origin-https-to-ssh", | ||
| "version": "1.0.7", | ||
| "version": "1.0.8", | ||
| "description": "Convert GitHub origin urls from HTTPS to SSH", | ||
@@ -29,5 +29,5 @@ "bin": { | ||
| "coordinates": [ | ||
| 45.5192014, | ||
| -73.5789198 | ||
| 45.51956819999999, | ||
| -73.5853929 | ||
| ] | ||
| } |
+13
-13
@@ -5,11 +5,4 @@ # github-origin-https-to-ssh | ||
| This is an evil shell script that really ought to be done in Javascript with better checks. PRs accepted. | ||
| This is an evil shell script that really ought to be done in Javascript with better checks. | ||
| ## Table of Contents | ||
| - [Install](#install) | ||
| - [Usage](#usage) | ||
| - [Contribute](#contribute) | ||
| - [License](#license) | ||
| ## Install | ||
@@ -23,2 +16,4 @@ | ||
| This has been aliased as `https-to-ssh`. | ||
| ```sh | ||
@@ -30,11 +25,16 @@ # In git repo with bad URL | ||
| This also works for enterprise or non-GitHub git remotes. | ||
| ```sh | ||
| $ https-to-ssh github.corporation.org | ||
| ## All fixed for enterprise | ||
| ``` | ||
| ## Contribute | ||
| PRs accepted. | ||
| Issues and PRs accepted. | ||
| Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. | ||
| ## License | ||
| SHell script from: https://gist.github.com/m14t/3056747 | ||
| MIT © Richard Littauer | ||
| Shell script from: https://gist.github.com/m14t/3056747 | ||
| [MIT](LICENSE) © Richard Littauer 2017 |
3670
46.1%5
66.67%