Is there a way to not have Bitbucket ask for my password every time when doing remote Mercurial operations?

社会主义新天地 提交于 2019-12-04 08:13:19

问题


With all other Mercurial repos that I push to, I can set my username and password in my hgrc (actually, Mercurial.ini since I'm using Windows) for doing operations at a particular domain, and Mercurial won't prompt me for auth info. However, even with these settings in place, Bitbucket always asks for my password.

My settings are as follows:

[auth]
bitbucket.prefix = bitbucket.org
bitbucket.username = myusername
bitbucket.password = mypassword

As I said, these settings work for all other repos I push to.


回答1:


Turns out the issue here was that I was using the URL for the repository displayed on my Bitbucket repository's page, which includes the username in front of the bitbucket domain name, so it ended up looking like https://myusername@bitbucket.org/myusername/myrepo.

Apparently, when the username is provided in this way, it ignores what's in the [auth] section. I just changed the URL in the hgrc for my local clone of the repo, and it picked up the [auth] section stuff just fine.

Apologies for not including this detail in the question.




回答2:


Are you using the ssh:// URLs for bitbucket or the https:// URLs? Bitbucket offers both. If it's ssh you need to use ssh-agent or similar ([auth] sections aren't used by ssh) to keep a key in memory or switch to the https: URLs. You could also try adding bitbucket.schemes = http https just in case, though if you're using the https:// URLs the default value of https should be fine. Also be aware that bitbucket usernames are case sensitive -- that got me for awhile.

If none of that's working for you try turning on debugging with --debug and see if there are any messages that help.



来源:https://stackoverflow.com/questions/3933693/is-there-a-way-to-not-have-bitbucket-ask-for-my-password-every-time-when-doing-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!