Have JavaHL remember SVN credentials (user/password)

I was forced to move from SVNkit to JavaHL, so I immediately crashed into the poor integration that JavaHL has by default with Eclipse.

I added a new repository, one in which my username is different from the one I use for my laptop, and even though Eclipse prompted me for the password I had no way to change the username. I tried to remove the conf folder from the .subversion one I have in my user’s home, but to no avail. I also wiped the .subversion directory altogether, but still it wanted me to use my local machine’s username.

Googled around, found no solution.

So, what I ended up doing is putting the full repository URL (complete with my username on the remote machine, as in svn+ssh://username@repository/path/to/repo) and exporting my SSH public key to the server. Yes, JavaHL asks you to type your password every. damn. time.

If you never generated your public key, just type ssh-keygen -t rsa in a shell and choose all the default options, they’re fine.

Then, export your key to the repository (one of the most frequent sequence of commands I’m using these days):

cat ~/.ssh/id_rsa.pub | ssh myUser@repository 'mkdir -p .ssh/; cat >> .ssh/authorized_keys'

Of course, replace myUser@repository with your username on the remote repository in the previous command, and you’re good to go 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s