Alexander Chen
Alexander Chen

Reputation: 507

Tortoise SVN use different accounts access different paths

In my repo, there are different accounts to control privileges for different folders, and there is a public account who has read-only privilege to aceess the whole repo.

For example

The repo path is:

svn://foo.bar/trunk/
svn://foo.bar/trunk/projectA/

And the public account pub has read-only privilege to access svn://foo.bar/trunk/.

My working account staffA has full priviege of svn://foo.bar/trunk/projectA/ but has NO priviege of svn://foo.bar/trunk/.

My local repo has been checkouted at D:\Worksapce\ with svn://foo.bar/trunk/.

Problem

  1. I can use pub to checkout/update for svn://foo.bar/trunk/
  2. I cannot use staffA to checkout/update for svn://foo.bar/trunk/ except projectA folder
  3. I can use staffA to commit on svn://foo.bar/trunk/projectA/
  4. The admin of the code refuesed to add read-pnly privilege to staffA for the trunk path.
  5. Linux's alias may solve the problem, but I'm working on Windows. And Tortoise SVN is very helpful while solving conflicts and comparing the history.

Every time I ci/up, I must type the corresponding account and password in the Tortoise SVN auth dialog without saving the auth.

Question

How can I update D:\Worksapce\ with saved pub account?

How can I commit D:\Worksapce\projectA with saved staffA account?

Upvotes: 0

Views: 1046

Answers (2)

tgharold
tgharold

Reputation: 731

For SVN (and git), if you want to talk to the same server, but use different credentials for various purposes, then you must use SSH access and not HTTPS (unless you can access the server with different names that match the SSL certificate).

With SSH, you can setup aliases for the server as different PuTTY sessions. So you could have the following URLs to get to the "foo.bar" repository:

svn+ssh://[email protected]/foo.bar/trunk
svn+ssh://[email protected]/foo.bar/trunk

The reason this works is because everything between // and / in the URL gets interpreted by plink (PuTTY) as the name of a PuTTY session that will tell it how to talk to the server (hostname, username, port, SSH key).

So in PuTTY, you would create two sessions that talk to the SVN server. One named [email protected] and the other named as [email protected] (case-sensitive). The fun part is that PuTTY sessions can be named just about anything, so you could use session names like Aspidistra (svn+ssh://Aspidistra/foo.bar/trunk).

That trick can be used for GitHub via SSH as well. Or on a Linux/Unix machine, you can set things up in ~/.ssh/config.


For HTTPS, it is more difficult and requires that the server certificate has alternate names. So if the server can be accessed as https://example.com/ and also https://svn.example.com/, then you could configure one set of credentials for the first and a different set of credentials for the latter.

Upvotes: 1

Lazy Badger
Lazy Badger

Reputation: 97365

Common short answer: nohow for pure GUI.

For any realm (hostname) Subversion can store and substitute only one authentication pair user/pass

But if you'll communicate with remote repo totally from CLI, you can have --username+--password options in command-line

Upvotes: 1

Related Questions