I had to do some work in mercurial repository on another computer. This repository has a subrepo.
The repository remote path is ssh://remote_username@server/path, so hg asks me for password for user remote_username. However, the subrepository has no username in the remote url, and when pushing, it asks me for password for the local username.
I have not found a way to force it to either authenticate as remote_username, or at least prompt for username.
I have tried changing hg config auth section and the subrepo hgrc, but neither worked. I may also update the url in .hgsub to include remote_username, but then I would have to push that as well, and everybody would have to authenticate as me, which is not quite desirable.
How can I force hg to use the username I want for remote authentication?
Hg version is 4.2.1.
OS is MacOS.
Protocol is ssh.
My first solution was to create a samba share (this functionality is built into MacOS), mount that from a Windows machine, and then use TortoiseHg's hg client, which prompts for username. This, however, requires another machine with Windows, so it's not much of an answer.
Recently I have found a better solution: create
/Users/local_username/.ssh/configand add the following to it:Where
serveris the server's URI andremote_usernameis the username I want to login as.Worked like a charm.