Mercurial Keyring Prompts for Password Every time - version-control

I am using the mercurial key-ring extension to store the password to my remote repository on BitBucket, so I don't have to enter it every time I push to the remote repository. Ironically, it asks me for the password to unlock the key-ring every time I need to access it; thereby completely mitigating its purpose to me. What am I doing wrong?
In my global mercurial config (~/.hgrc) I have the following lines:
[extensions]
hgext.mercurial_keyring = /etc/mercurial/mercurial_keyring.py
In my repo mercurial config (.hg/hgrc), I have:
[paths]
default = https://username#bitbucket.org/username/repo
Example:
> hg out
> comparing with https://username#bitbucket.org/username/repo
> Please enter password for encrypted keyring:
I have tried uninstalling the keyring and trying again. I've also played about with configuration settings I've found online to no avail. I also couldn't find anything on encrypted keyring and non-encrypted keyring in regards to mercurial.
How can I get it so that I don't have to enter a password at all when I perform actions to the remote repo?

I don't know if this was already the case at the time the question was asked, but now the solution is directly explained in the keyring extension wiki link in your question.
Just enabling the keyring extension is not enough, you also need to tell Mercurial the remote repo and the username in the config file.
Quote from the link:
3.2. Repository configuration (HTTP)
Edit repository-local .hg/hgrc and save there the remote repository
path and the username, but do not save the password. For example:
[paths]
myremote = https://my.server.com/hgrepo/someproject
[auth]
myremote.schemes = http https
myremote.prefix = my.server.com/hgrepo
myremote.username = mekk
Simpler form with url-embedded name can also be used:
[paths]
bitbucket = https://User#bitbucket.org/User/project_name/
Note: if both the username and password are given in .hg/hgrc, the
extension will use them without using the password database. If the
username is not given, extension will prompt for credentials every
time, also without saving the password. So, in both cases, it is
effectively reverting to the default behaviour.
Note that you don't need to specify all the information shown in those examples.
On my machine (Mercurial 5.0.2 on Windows), I'm using a simpler form which also works for multiple repos.
This is a 1:1 copy from my actual config file:
[extensions]
mercurial_keyring =
[auth]
bb.prefix = https://bitbucket.org/
bb.username = christianspecht
This uses the keyring extension to save the password for the user christianspecht, for all remote repos whose URL starts with https://bitbucket.org/.
The prefix bb can be freely picked, so you can use this to save multiple URLs/usernames at once.
This works perfectly well (at least until Bitbucket drops Mercurial support in a few weeks...) - it asks for the password once, then it's automatically saved and it never asks again.

it asks me for the password to unlock the key-ring. What am I doing wrong?
Nothing. Read the keyring docs, password for accessing keyring must be provided once for session

Related

Is there a way to stop datajoint from asking for username and password when I import it

In Datajoint, you are prompted for username and password. I am creating a readthedocs website with Sphinx and I need the system to not prompt for username and password. How can I turn it off?
Thanks for asking this question!
There are basically three ways to do this:
dj.config.save_local(): This will save the entire dj.config as json on your project level
dj.config.save_global(): This will save is on a system level
System Variables DJ_HOST, DJ_USER, and DJ_PASS: Can be set for once like export in terminal or permanently in ~/.bashrc or ~/.zsh_profile for linux/mac or in your system settings/environment variable settings for windows
Please check DataJoint Documentation for more details
DataJoint asks for database credentials only when they are not already provided in the settings dictionary dj.config. These values can be set programmatically, loaded from a configuration file, or loaded from environment variables. These settings are described in the documentation: https://docs.datajoint.org/python/setup/01-Install-and-Connect.html

pgAdmin failed to save password for users

I have pgAdmin (dpage/pgadmin4:4.29) container running in Kubernetes. As a master user I have added Database connections and share the connection. I can disconnect/reconnect to database without password as a master user.
But for additional users I have created, those users password are not getting saved even they have selected Save Password option at the time of connection. pgAdmin keep asking for password when connecting to DB.
What I am missing in my setup.
NobleUplift's issue of the "Save Password" checkbox being disabled can be caused by certain config flags in the config.py file. Remembering passwords for SSH tunneling is disabled by default, for example.
You can re-enable the checkbox by writing
ALLOW_SAVE_TUNNEL_PASSWORD = True # SSH tunnel password saving, default False
ALLOW_SAVE_PASSWORD = True # database password saving, default True
to a new config_local.py file in the same directory where you find your main config.py file. Pg discourages writing the the main config.py file directly. See the docs for more details about the preferred config file and where to find them. (I found mine under "pgAdmin 4\v6\web\config.py", not where the docs said.)
This seems to be where the 'disable password saving' idea came from.
Apologies roy for not answering your question directly, but I didn't have the ability to respond directly to Noble. However, the config docs also mention that the ENHANCED_COOKIE_PROTECTION flag can interfere with Kubernetes (and other auth settings), which might be worth a look.

How have I saved Gitlab username and password in Visual Studio Code, Windows?

This is a strange question, but I cannot find how I did this:
I have three computers, all of them with visual studio code and an account in gitlab. In two of them, my operation has been
git clone ___.git
cd folder
git init
git remote add origin ___.git
And then, every time I push,... I have to enter my id and pass.
But in my first computer, I did something that I don't need to enter the id and pass anymore, it just pushes without hassle.
Then, I thought I must have done something like this
https://git-scm.com/docs/git-credential-store
But when I look for .gitconfig, which I find in the /Users folder, there I only have my user.name (which is not the one of gitlab), the email (this one is the gitlab email) but no password entry. And I cannot find any other .gitconfig files anywhere. For sure I didn't set up any SSH key.
So here the question, what did I do?
Make sure to use the GCMfW: Git-Credential-Manager-for-Windows:
git config --global credential.helper manager
Then try again: that should cache your username / password, provided you are using an HTTPS (https://...) URL, not an SSH one.

unable to get SSH keys working between sourcetree and github

I was able to create a key and connect to github following these instructions via the command prompt successfully:
https://help.github.com/articles/generating-ssh-keys
However, when I try to connect via Sourcetree and putty I cannot. I've tried:
generating a new key with the putty key generator (SSH-2 RSA)
entering a passphrase
saving the private key
saving the public key and adding a .pub extension
copying/pasting the key from the putty key generator window into github
attemping to refresh branches on a pull from my private github repository from my local repo using the SSH clone URL I got from github
I also tried opening the key generated from the github command line instructions and it wanted me to convert it to a putty-type key which I did and saved off, tried with that one. Also no luck.
What am I doing wrong?
In order to get it worked I ended up going to Tools -> Options -> SSH Client and changing it to OpenSSH. I generated and uploaded several different types of keys trying to get it work as well but I think this is what finally did it.
In my case, I needed to switch to a git or ssh based repo path rather than the https based repo path. This causes SourceTree to switch to SSH based authentication.
This setting can be found at Repository => Repository setting => Paths
Example:
Correct repo paths
git#github.com:<username>/<reponame>.git
or
ssh://git#github.com/<username>/<reponame>.git
(Note: if you are working with a repo that isn't yours, replace username with organization name)
Wrong repo path
https://github.com/<username>/<reponame>.git
HTTPS repo paths result in SourceTree trying to be extra smart and failing spectacularly. You get prompted for a username/password GUI dialog which will never work if you have 2 factor authentication enabled.
To login to Github account using SourceTree you may use access tokens. To create an access token follow these steps.
Go to Settings
Select Developer settings from left pane
Select Personal access token
Click on Generate new token button
Give it a name
Select scopes and generate token (save this token somewhere safe because you won't be able to access this token again)
Then in SourceTree app follow these steps (for Mac users, not sure about the other platforms)
Go to Preferences->Accounts
Click add button
Select GitHub from Host dropdown
Choose Basic from Auth Type dropdown and HTTPS from Protocol dropdown
Enter your GitHub username in Username field
Paste the access token generated in the previous process in the Password field
Click save and you're done
For Mac versions of SourceTree the Tools menu does not exist.
However, you can add the ssh key to your keychain in Mac OS. See: https://superuser.com/questions/879050/sourcetree-ssh-options-on-os-x
On Mac OSX, the native SSH client can use the built-in keychain directly. To add your private key to the keychain simply use the command:
ssh-add -K /path/of/private/key
As an example if your private key is stored at ~/.ssh and is named id_rsa, you would use the command:
ssh-add -K ~/.ssh/id_rsa
You will then be prompted for your passcode, which will be stored in your keychain. After this you should be ready for a password-less login.
You may want to consider switching from OpenSSH to Putty / Plink and use embedded Git instead of Git provided by host OS. Making ssh-agent work on Windows is a bit more complicated than clicking it out straight from the SourceTree and PuttyGen.
If you want to still use terminal to configure SSH and start ssh-agent please see bottom two steps.
For Sourcetree on MacOS I had to change from OAuth to Basic authentication, use "git" as the username (not my GitHub username), and generate the SSH key and input it into GitHub. Only then could I clone a GitHub repo via SSH in Sourcetree.

disassociate windows username from subclipse without saving credentials

I am using subclipse with eclipse indigo on Windows 7. When I commit a change and am prompted for my username/password, the plugin pre-populates my svn username with my Windows username in the authentication dialog box. I'd like it to put my repository username instead (or alternately nothing), but I don't want to save my credentials. I can only find instructions for saving both username and password.
I don't have anything stored in C:\Users\{USER}\AppData\Roaming\Subversion\auth\svn.simple. I've tried saving my password and then modifying the file which gets put in svn.simple, but it's not clear to me how to edit it manually, and deleting the couple of lines which store the password does not work.
I've tried including my username in the path of my repository URL(https://svnuser#server/path/to/repo), checking out a project, and synchronizing with the repository. When I try to commit something, my Windows username is pre-populated.
Edit %APPDATA%\Subversion\config and in the [auth] section add:
store-passwords = no
Subversion will cache your username but not your password.
Note that in the %APPDATA%\Subversion\servers file you can also override the default username:
username = myusername
You can put this in the [global] section or in a custom group for a specific domain.