About git url parser
Git remotes can be HTTPS or SSH. The parser splits a URL into host, owner and repository, and converts between the two forms.
The forms
- HTTPS: https://github.com/owner/repo.git
- SSH: [email protected]:owner/repo.git
Which to use
HTTPS works everywhere and uses tokens. SSH uses keys and avoids typing credentials, which many developers prefer. Change a remote with git remote set-url.
A worked example
https://github.com/TechIntact/wevivid.git is host github.com, owner TechIntact and repository wevivid. Its SSH form is [email protected]:TechIntact/wevivid.git. You can change an existing remote with git remote set-url origin <new-url>.
A warning about credentials
- Never embed a personal access token inside a URL. It is stored in plain text in .git/config and shows up in commands and logs.
- Use a credential helper or an SSH key instead.
- If a token has been exposed, revoke it and create a new one.
