13

I am developing on a mac and using an svn server on another machine using svn_ssh.
While I was able to do an initial check-in and check-out, I cannot do a commit from the command line because the system tries to use my local username jondoe (and prompts a password) when connecting to the remote server where my username is johnd.

So, how can I tell the svn+ssh to use johnd for my commits?

3 Answers 3

44

Use --username option

svn commit --username johnd
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks but that yields another error: svn commit --username johnd svn: Commit failed (details follow): svn: system('vim svn-commit.tmp') returned 256 svn: Your commit message was left in a temporary file: svn: '/Users/johndoe/development/Myapp/svn-commit.tmp'
@Calgacus - I have a Mac, and use the same sort of syntax to set the Subversion user name. When you give it --username, it should have asked for a password. You can also pass a password via the --password parameter. I wonder if the problem you got is with the vim command and not with the svn command itself. Try svn commit --user johnd -m "commit description" which bypasses vim for entering the commit message.
@Calgacus: looks like svn failed to find your default editor. Either set EDITOR or SVN_EDITOR environment variables appropriately or pass commit message by -m option. See also this question.
If it's that easy, why some people create a dedicated system user just for committing to a svn repository?
6
  1. Backup your changes (just changed files, you mustn't overwrite .svn directory)
  2. Checkout again, but now using your remote username

    svn checkout svn+ssh://<ssh_username>@<svn host domain>/<server repository path>
    
  3. Restore your changes from backup

  4. Commit them

    svn commit -m 'Description'
    

I've just successfuly checked out and committed with different local and SSH usernames.

2 Comments

Thanks but it gives the error: svn: Must give local path (not URL) as the target of a commit. I tried like this: svn commit -m 'Summary of changes' . svn+ssh://my-username@my-server/my-home/my-repo just using . for myfiles
ok that seems to have worked but I'll repost here if I start getting the same error later. I had to modify your instructions to get it to work as when I did the checkout it failed saying that 'Myapp is already a working copy for a different URL'. so I just moved the Myapp dir to MyappXYZ and then your suggestion worked. I had thought of doing it this way but was hoping not to as I suspect the error will recur as this is pretty much the same way I originally checked out my project. Thanks.
3

In your ~/.ssh/config, add a section like this:

Host svn.example.com
User johnd

Replace svn.example.com with the hostname of the svn server.

This will work for all ssh connections, not just subversion-related ones.

See also the manual page ssh_config, which you may be able to read by running man ssh_config in a shell.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.