Branches and remotes
Remotes
3 min read
A remote is a nickname for the address of another repository, usually the project on the server
(origin). A repository can have several: in a fork, it's common to have origin (your fork) and
upstream (the original project). The left panel's REMOTE section lists the remotes and, inside
each one, the remote branches.
- Each remote shows up as a folder with its branches. The tooltip shows the URL and reminds you: "Drag a local branch here to push it".
- The + in the header (tooltip: "Add remote") opens the add dialog.
- With no remote, the section shows "No remotes configured" and the Publish to server… button (see Publish repository).
- Double-clicking a remote branch checks it out (see Checkout).
Right-click the remote's name:
| Item | What it does |
|---|---|
| Fetch origin | Fetches from this remote only (see Fetch). |
| Edit origin… | Changes the name and the URL. |
| Copy remote URL | Copies the URL (notice "URL copied"). |
| Open origin in the browser | Opens the project's page. It shows up when the web address can be built from the URL (HTTPS or SSH). |
| Cleaning up branches that were already merged | See Hygiene and flow. |
| Hide all branches of origin / Show all branches of origin | Removes this remote's branches from the graph or puts them back (see Graph). |
| Add remote… | Opens the add dialog. |
| Remove origin… | Removes the remote from this repository. |
- The + in the REMOTE section header.
- A remote's menu: Add remote….
- Palette (Ctrl+P): "Add remote…".
- Push in a repository without a remote opens this dialog when there's no GitLab or GitHub registered.
- In the Publish repository dialog: Add an existing remote….
- Open Add remote.
- In Name, leave
origin(the default) or type another one, such asupstream. - In URL, paste the address (
https://…orgit@…), for examplehttps://gitlab.exemplo.com/equipe/app.git. - Click Add. The bar shows "Adding remote…" and then Versora fetches right away to list the new remote's branches.
| Field | What it is | Default |
|---|---|---|
| Name | The remote's nickname. | origin |
| URL | The repository's HTTPS or SSH address. | empty (required) |
git remote add upstream https://gitlab.exemplo.com/equipe/app.git
git fetch --all --prune --tags
- The remote's menu › Edit origin….
- In the Edit origin dialog, change the Name and/or the URL.
- Click Save. If nothing changed, nothing happens.
git remote rename origin gitlab # if the name changed
git remote set-url gitlab [email protected]:equipe/app.git
Renaming the remote also renames the remote branches (origin/main becomes gitlab/main) and
adjusts the local branches' upstream.
- The remote's menu › Remove origin….
- The Remove remote dialog asks: "Remove remote "origin" and its remote-tracking branches? The remote repository itself isn't affected."
- Click Remove.
git remote remove origin
The local branches stay, but the ones that tracked this remote's branches are left without an upstream.
When you have more than one account on the same server (personal and work, for example), each remote uses the right account on its own, or the one you choose. The choice applies to fetch, pull and push. See Accounts.
Adding, editing and removing a remote change the repository's configuration and the remote branches, which Versora's Ctrl+Z doesn't track: it restores branches, tags, HEAD and stashes. So these actions usually aren't added to the undo history, and a Ctrl+Z right after undoes the previous operation, if there is one. The exception is the fetch that comes with Add: if it brings new tags, the operation is added as "Add remote ‹name›", and Ctrl+Z deletes only those tags; the remote and its remote branches stay. To go back, edit, add or remove the remote again from the same menu.
- "Enter the remote's name and URL.": both fields in the edit dialog are required.
- A name that already exists is refused by git: choose another name.
- A fetch failure right after adding (credential, certificate, proxy): the remote was added anyway. Fix the access and fetch again.
- "your company's policy doesn't allow the server …": the URL points to a server outside the company
policy's
allowed_serverslist.
- Credentials per server: Git servers.
- Company policy:
allowed_servers(see Administrators).