How do I get a SVN checkout using a Public/Private

2019-01-30 12:14发布

I have to check some code and run it. I have the URL:

svn+ssh://myuser@www.myclient.com/home/svn/project/trunk

I have a file with their private key. What do I do to get this code?

标签: svn ssh key
7条回答
我想做一个坏孩纸
2楼-- · 2019-01-30 12:17

The private key goes on the client machine, often named as ~/.ssh/id_rsa, ~/.ssh/id_dsa, or ~/.ssh/identity depending on the SSH version and the type of key. However, you can just use ssh -i path/to/private.key.

This is presuming that the corresponding public key exists on the server in ~/.ssh/authorized_keys, and that your local machine is running the OpenSSH client. If you are using PuTTY on Windows, simply open up the Pageant program, and import the key via the GUI.

查看更多
做个烂人
3楼-- · 2019-01-30 12:17

Add this entry to your ~/.ssh/config file:

Host YOUR_SERVER
IdentityFile YOUR_PRIVATE_KEY_PATH # (ex: ~/.ssh/rsa)
User USER_NAME

For more options, see the ssh_config man page.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-30 12:25

If you need to use a custom key just for svn, the following will work:

SVN_SSH="ssh -i /path/to/key_name"

export SVN_SSH

svn commands

http://labs.kortina.net/2010/01/30/svn-checkout-with-private-key-over-ssh/

查看更多
放我归山
5楼-- · 2019-01-30 12:30

Here are the steps that I used to connect from the Mac OS X command line to my server via svn+ssh:

On server:

ssh-keygen -b 1024 -t dsa -f mykey   (creates mykey and mkey.pub files)

Copy contents of mykey.pub to ~/.ssh/authorized_keys (create authorized_keys file if it doesn't exist)

Download mkey to your local machine and run:

chmod 600 mkey  (the next step won't run otherwise)
svn-add mkey  (enter your passphrase)

checkout from your svn server with ssh:

svn co svn+ssh://user@server.com/repos/path

Delete mkey and mkey.pub from your server

查看更多
唯我独甜
6楼-- · 2019-01-30 12:31

Add the private key to your ~/.ssh/ folder and then run ssh-agent $SHELL; ssh-add;, and then the svn co of that URL should work.

查看更多
何必那么认真
7楼-- · 2019-01-30 12:39

In addition to the answers two screen shots from Eclipse 3.7 with Subversive.


General settings
Enter the user name! (I have forgotten this before taking the screen shot). Do not enter a password.


SSH Settings Enter the key passphrase if you private key is passphrase protected.


A picture is worth a thousand words.

查看更多
登录 后发表回答