Set-GitRemotes: имя repo из remote URL, не из имени папки.
This commit is contained in:
@@ -15,7 +15,23 @@ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_name="${REPO:-$(basename "$(git rev-parse --show-toplevel)")}"
|
||||
repo_name_from_url() {
|
||||
local url="$1"
|
||||
if [[ "$url" =~ /([^/]+)(\.git)?/?$ ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
fi
|
||||
}
|
||||
|
||||
repo_name="${REPO:-}"
|
||||
if [[ -z "$repo_name" ]]; then
|
||||
for remote in kalinamall home github origin; do
|
||||
if url="$(git remote get-url "$remote" 2>/dev/null)"; then
|
||||
repo_name="$(repo_name_from_url "$url")"
|
||||
[[ -n "$repo_name" ]] && break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
repo_name="${repo_name:-$(basename "$(git rev-parse --show-toplevel)")}"
|
||||
home_url="ssh://git@git.papatramp.ru:2222/${OWNER}/${repo_name}.git"
|
||||
kalinamall_url="ssh://git@git.kalinamall.ru:2222/${OWNER}/${repo_name}.git"
|
||||
github_url="git@github.com:${GITHUB_ORG}/${repo_name}.git"
|
||||
|
||||
Reference in New Issue
Block a user