Shell – How to make svn save credentials when –non-interactive

shell-scriptsubversion

I'm trying to get svn to save my https username+password to ~/.subversion from within an automated script. I can pass creds on the command-line but I do not want to be prompted about whether to save the password unencrypted. Unfortunately this does not create ~/.subversion/:


svn --non-interactive --trust-server-cert --username myusername --password secret co https://private.example.com/src/repo/

FYI I'm trying to do this for a Dockerfile that invokes a bower install with a bower.json that references a password-protected svn repo. Unfortunately there's no way to pass the svn credentials to bower via command-line or environment.

I am currently working around it by running svn interactively and letting it create ~/.subversion, then zipping up that entire directory and ADDing it in the Dockerfile. I guess I could look at the file formats in ~/.subversion and create it with a script, but would rather let svn do it.

Best Answer

Credentials will be saved if you use --username and --password without --non-interactive and --trust-server-cert.

I'm assuming that you are using --non-interactive and --trust-server-cert to avoid the prompt that asks you to accept the certificate. To still avoid this prompt without those parameters, you can have your script create a copy of the file that is generated for each accepted cert in ~/.subversion/auth/svn.ssl.server. This file will be the same for everyone for each respective server. I'm currently using this solution for a script.

Related Question