Skip to content

Instantly share code, notes, and snippets.

@1eedaegon
Last active November 27, 2023 12:46
Show Gist options
  • Save 1eedaegon/1362bd741604f36ce774143e0fb4ac37 to your computer and use it in GitHub Desktop.
Save 1eedaegon/1362bd741604f36ce774143e0fb4ac37 to your computer and use it in GitHub Desktop.
How to get git remote path without semi colon
# 1.
$(git remote -v | tail -1 | awk -F"@" '{print$2}' | awk -F".git" '{print$1}' | sed 's/:/\//g')
# 2.
$(git remote -v | sed -n '1p' | awk -F '@' '{print $2}' | sed -e 's/\:/\//g' | awk -F '.git' '{print $1}')
# example
❯ go mod init $(git remote -v | tail -1 | awk -F"@" '{print$2}' | awk -F".git" '{print$1}' | sed 's/:/\//g')
go: creating new go.mod: module github.com/1eedaegon/ory-practice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment