Subversion on Mac - refuses to get password from keychain
Asked Answered
R

7

9

On Mac OS X Leopard - when I try and access a remote repository from Terminal it always asks for: 1. Password 2. Username 3. Password (again)

with the message: "Authentication realm: http://svn.myserver.com:80 Subversion"

I've checked and my credentials are being stored in Keychain and SVN has access to them. Why won't it use them?

Richert answered 19/3, 2009 at 11:52 Comment(0)
O
5

I got this solved by recursively changing the owner of the subversion authentication directory:

sudo chown -R myuser:staff ~/.subversion/auth/

(previous user:group pair was set to root:staff)

You also need to set password-stores = keychain on subversion configuration file:

~/.subversion/config

Olivia answered 19/10, 2011 at 0:59 Comment(1)
But ~/.subversion/auth/ is used by the unencrypted plaintext backend, right?Goffer
C
4

By default, svn (and most Unix apps) pass your local username as the username for remote login. I suspect that your account name on the Subversion server is different from your local account name. Thus, authentication fails the first time you enter your Subversion password, and svn, like most Unix apps then asks for the remote username and password and attempts to reauthenticate. You can pass your remote user name using the --username option to svn:

svn --username [remote_username] ...
Cohen answered 19/3, 2009 at 16:32 Comment(1)
Subversion <= 1.5 supported the OSX keychain and Windows CryptoAPI. Subversion 1.6 adds Gnome's an Kde's keystore to that listWillenewillet
K
3

I solved this problem by just removing the corresponding authentication file in ~/.subversion/auth/svn.simple (find the right one with with grep as they're named funny). Then after the next svn up in that repository (where svn asked fro username and password) it is now working correctly.

Kumkumagai answered 7/6, 2010 at 9:49 Comment(1)
Again, I would not encourage anyone to use the plaintext backend. OP asked why svn would no longer use Keychain, which is a much safer method, and trias may have a useful answere here: https://mcmap.net/q/1172284/-svn-does-not-store-password-nor-usernameGoffer
P
3

I ran into the same problem when running svn commands from an ssh window. Based on some comments above I removed the associated file under ~/.subversion/auth/svn.simple and then ran my svn command from a terminal session directly on the OSX box which made a window pop up asking if I wanted to grant permission for svn to read my keychain. I granted it permission forever and now the svn command in my ssh window works without prompting me for my password.

Paragraphia answered 3/7, 2012 at 12:39 Comment(1)
This also worked for me - i feel like all of these answers are applicable at some point: could probably be consolidated into a troubleshooting guide or something.Rectitude
C
3

Tried many things from thread, this worked for me:

  • uncomment password-stores = keychain in ~/.subversion/config
  • checkout/update your repo, enter credentials.
  • open keychain app, find line(s) with address of your repository in login keychain, double click it(or each of them), select Access Control tab and and check "Allow all applications to access this item"

After that subversion finally remember my credentials.

Btw this problem began when I switched from default terminal to iTerm2 + zsh + oh my zsh

Corral answered 22/6, 2018 at 13:45 Comment(1)
I tried a bunch of the other solutions and it was the "Allow all applications to access this item" item that fixed this for meJeanette
C
1

Can you provide more information? Keychain caching of passwords wasn't added until Subversion 1.4.x. Do you get any error? We'll need more information to help.

Continuator answered 19/3, 2009 at 23:48 Comment(0)
V
0

I don't have the answer, but I notice that if I'm logged into my machine locally, then subversion will read the keychain password, but if I ssh into the mac from a remove machine, then subversion will not read the keychain password.

Seems that the ssh login puts the svn command in an environment which does not have access to the keychain...

Could that be your issue?

Vauntcourier answered 15/3, 2011 at 5:30 Comment(1)
If you have logged in via ssh then you can issue security unlock-keychain ~/Library/Keychains/login.keychain to get access to the default keychain.Ailis

© 2022 - 2024 — McMap. All rights reserved.