diff --git a/gp b/gp index 9dd2bde..3454f5c 100755 --- a/gp +++ b/gp @@ -485,15 +485,15 @@ parse_gitea_remote() { # Match https://TOKEN@HOST/OWNER/REPO.git or https://HOST/OWNER/REPO.git local token="" host="" owner="" repo="" - if [[ "$remote_url" =~ ^https://([^@]+)@([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then + if [[ "$remote_url" =~ ^https://([^@]+)@([^/]+)/([^/]+)/(.+)$ ]]; then token="${BASH_REMATCH[1]}" host="${BASH_REMATCH[2]}" owner="${BASH_REMATCH[3]}" - repo="${BASH_REMATCH[4]}" - elif [[ "$remote_url" =~ ^https://([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then + repo="${BASH_REMATCH[4]%.git}" + elif [[ "$remote_url" =~ ^https://([^/]+)/([^/]+)/(.+)$ ]]; then host="${BASH_REMATCH[1]}" owner="${BASH_REMATCH[2]}" - repo="${BASH_REMATCH[3]}" + repo="${BASH_REMATCH[3]%.git}" else return 1 fi