7.1.1 Remote Commands
The transient prefix command magit-remote
is used to add remotes and to make changes to existing remotes. This command only deals with remotes themselves, not with branches or the transfer of commits. Those features are available from separate transient commands.
Also see the git-remote(1) manpage.
M
    (magit-remote
)​
This transient prefix command binds the following suffix commands and displays them in a temporary buffer until a suffix is invoked.
By default it also binds and displays the values of some remote-related Git variables and allows changing their values.
user option
magit-remote-direct-configure​
This option controls whether remote-related Git variables are accessible directly from the transient magit-remote
.
If t
(the default) and a local branch is checked out, then magit-remote
features the variables for the upstream remote of that branch, or if HEAD
is detached, for origin
, provided that exists.
If nil
, then magit-remote-configure
has to be used to do so.
M C
    (magit-remote-configure
)​
This transient prefix command binds commands that set the value of remote-related variables and displays them in a temporary buffer until the transient is exited.
With a prefix argument, this command always prompts for a remote.
Without a prefix argument this depends on whether it was invoked as a suffix of magit-remote
and on the magit-remote-direct-configure
option. If magit-remote
already displays the variables for the upstream, then it does not make sense to invoke another transient that displays them for the same remote. In that case this command prompts for a remote.
The variables are described in Remote Git Variables.
M a
    (magit-remote-add
)​
This command add a remote and fetches it. The remote name and url are read in the minibuffer.
M r
    (magit-remote-rename
)​
This command renames a remote. Both the old and the new names are read in the minibuffer.
M u
    (magit-remote-set-url
)​
This command changes the url of a remote. Both the remote and the new url are read in the minibuffer.
M k
    (magit-remote-remove
)​
This command deletes a remote, read in the minibuffer.
M p
    (magit-remote-prune
)​
This command removes stale remote-tracking branches for a remote read in the minibuffer.
M P
    (magit-remote-prune-refspecs
)​
This command removes stale refspecs for a remote read in the minibuffer.
A refspec is stale if there no longer exists at least one branch on the remote that would be fetched due to that refspec. A stale refspec is problematic because its existence causes Git to refuse to fetch according to the remaining non-stale refspecs.
If only stale refspecs remain, then this command offers to either delete the remote or to replace the stale refspecs with the default refspec ("+refs/heads/*:refs/remotes/REMOTE/*").
This command also removes the remote-tracking branches that were created due to the now stale refspecs. Other stale branches are not removed.
user option
magit-remote-add-set-remote.pushDefault​
This option controls whether the user is asked whether they want to set remote.pushDefault
after adding a remote.
If ask
, then users is always ask. If ask-if-unset
, then the user is only if the variable isn’t set already. If nil
, then the user isn’t asked and the variable isn’t set. If the value is a string, then the variable is set without the user being asked, provided that the name of the added remote is equal to that string and the variable isn’t already set.