threads / discuss / 66630

Feature request: update password in remote URL

Subject: Feature request: update password in remote URL

## tl;dr

2 messages between Oct 22, 2026 and Oct 22, 2026.

replies: 1people: 2as markdown or json

Ján Waclawek· Oct 22, 2026, 09:52 UTC · lore

It would be useful to have a Git command that replaces only the password embedded in a remote URL, preserving the username, hostname, path, and other URL components.

For example:
git remote set-password origin NEW_PASSWORD

Security policies on various git servers stipulate to change password relatively often. Currently, if a password expires or changes, users must reconstruct the remote URL with the new password or use a script to modify it. A dedicated command would make this operation simpler and less error-prone.

The command should replace only the password component and preserve all other parts of the URL unchanged.

I am aware of existence of credential managers, but sometimes they are just too much. I also understand that storing passwords in remote URLs has security drawbacks, but this feature would help users who already use the embedded credentials, work with servers that require URL-based credentials and understand those drawbacks.

Jan Waclawek
brian m. carlson· Oct 22, 2026, 21:19 UTC · re: Ján Waclawek · lore

Re: Feature request: update password in remote URL

On 2026-10-22 at 09:52:27, Ján Waclawek wrote:
Show 22 quoted lines
> It would be useful to have a Git command that replaces only the
> password embedded in a remote URL, preserving the username, hostname,
> path, and other URL components.
> 
> For example:
> 
> git remote set-password origin NEW_PASSWORD
> 
> Security policies on various git servers stipulate to change password
> relatively often. Currently, if a password expires or changes, users
> must reconstruct the remote URL with the new password or use a script
> to modify it. A dedicated command would make this operation simpler
> and less error-prone.
> 
> The command should replace only the password component and preserve
> all other parts of the URL unchanged.
> 
> I am aware of existence of credential managers, but sometimes they are
> just too much. I also understand that storing passwords in remote URLs
> has security drawbacks, but this feature would help users who already
> use the embedded credentials, work with servers that require URL-based
> credentials and understand those drawbacks.

I don't think we're going to implement or accept such a feature. In fact, we've discussed disallowing URL-based credentials altogether a couple times on the list. The only reason we haven't done so is that we agree it's convenient for test environments where the credentials have no value.

We also know that since the URL is stored in the config file, it's actually very frequent that people expose the config file (such as on web servers in some cases) and then they've exposed their credentials; this is especially bad if the credentials are read-write, since then the repository can be written to.

Credential helpers can actually be very simple to use and the Git FAQ provides an example[0] of how to use one to read credentials from an environment variable. There's also `git-credential-store`, which is shipped with Git and which also uses a plaintext file, but not one under the repository by default.

You can also use SSH with a public key if your server supports it and you can use something like a deploy key to let systems automatically fetch and push if necessary.

So for those reasons (and probably some others I've forgotten), we're not really interested in making support for using credentials in the URL easier given there are much better alternatives.

[0] https://git-scm.com/docs/gitfaq#http-credentials-environment
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

← back to recent threads