grit remote
grit remote add <name> <url>
grit remote refs <remote-or-url> [--heads] [--tags] [<prefix>…]
Description
A remote is another copy of the repository that you fetch from and push to, usually on a server. With no arguments, grit remote lists your remotes and their URLs.
grit remote add adds a remote. grit fetch then stores the remote's branches as remote-tracking branches named <name>/<branch>, such as origin/main. grit clone adds a remote called origin for you.
grit remote refs lists references on a configured remote name or a literal URL/path (same transports as grit clone), matching git ls-remote ordering.
Options
| Option | Description |
|---|---|
add <name> <url> |
Add a remote called <name> at <url>. Fails if a remote with that name exists. |
refs <remote-or-url> |
List refs on the remote (or URL). |
--heads |
With refs, only refs/heads/. |
--tags |
With refs, only refs/tags/. |
<prefix>… |
With refs, optional ref prefixes (same rules as git ls-remote). |
JSON output
Pass --json for stable, scripting-friendly output:
| Field | Type | Meaning |
|---|---|---|
action |
string | list, add, or refs. |
remotes |
array | For list, each remote with name and url. |
name |
string | For add, the remote name. |
url |
string | For add, the remote URL or path. |
refs |
array | For refs, each entry with name, oid, optional peeled, optional symref_target. |