How to change git ssh user for a remote push temporarily?

Have you tried using the whole remote URL?

git push ssh://<temp_user>@<host>/<repo_path> <local_branch>:<remote_branch>

and you will be prompted to provide the password

Leave a Comment