如何在svn + ssh url中使用git-svn [英] How to use git-svn with svn+ssh url

查看:178
本文介绍了如何在svn + ssh url中使用git-svn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在cygwin中将git svn clone命令与我们公司的svn存储库一起使用.

I like to use in cygwin the git svn clone command with our company svn repository.

此网址为svn+ssh://svn.<url>.com/repo

在此之下,我可以看到例如用trunk/tags/branches使存储库黯然失色

under this I can see with e.g. eclipse the repository with trunk/tags/branches

运行git svn clone svn+ssh://svn.<url>.com/repo

没有这样的文件或目录:无法连接到URL上的存储库 'svn + ssh://svn..com/repo':子进程错误:'ssh'的exec 失败:/usr/lib/git-core/git-svn行中没有这样的文件或目录 2299

No such file or directory: Unable to connect to a repository at URL 'svn+ssh://svn..com/repo': Error in child process: exec of 'ssh' failed: No such file or directory at /usr/lib/git-core/git-svn line 2299

任何人都可以帮助我做什么以及如何做?

Any one can help me what and how to do this ?

推荐答案

必须同时使用私钥和公钥ssh来设置svn + ssh协议.

The svn+ssh protocol must be setuped using both the private and the public ssh key.

如果在Windows中使用Windows,则必须先设置ssh密钥,然后再运行 svn客户端使用与本机Windows svn.exe相关的这些常规步骤(例如,不应移植为非完全本机的msyscygwin工具):

In case of in the Windows usage you have to setup the ssh key before run the svn client using these general steps related to the native Windows svn.exe (should not be a ported one, for example, like the msys or cygwin tools which is not fully native):

  1. 安装putty客户端.
  2. 使用puttygen.exe实用工具和正确的密码类型生成密钥 密钥取决于svn集线器服务器(Ed25519,RSA,DSA等).
  3. 通过阅读从文档到服务器的步骤,将已生成的密钥的公共变体安装到svn集线器服务器中.
  4. 使用以下内容创建SVN_SSH环境变量:SVN_SSH="<path-to-plink>/plink.exe" -batch -l "<USERNAME>".这样可以避免由于交互式登录/密码请求而导致脚本挂起,并且可以避免使用用户名位于内部的svn存储库url.
  5. 确保所有svn工作副本及其中的externals属性都包含带有svn+ssh://前缀的有效svn存储库URL.如果没有,请使用svn relocate https:// svn+ssh://命令切换到该命令.然后修复所有externals属性中的其余url,例如,只需删除url方案前缀并保留//前缀即可.
  6. 使用先前生成的私钥在后台运行pageant.exe(添加它).
  7. 通过putty.exe客户端测试与svn集线器服务器的连接.如果pageant.exe已启动并与之一起运行并已正确设置了私钥,则客户端不应要求输入密码.如果SVN_SSH环境变量用用户名声明,则客户端也不应要求用户名.
  1. Install the putty client.
  2. Generate the key using the puttygen.exe utility and the correct type of the key dependent on the svn hub server (Ed25519, RSA, DSA, etc).
  3. Install the been generated public variant of the key into the svn hub server by reading the steps from the docs to the server.
  4. Create the SVN_SSH environment variable with this content: SVN_SSH="<path-to-plink>/plink.exe" -batch -l "<USERNAME>". This would avoid hangs in scripts because of interactive login/password request and would avoid usage svn repository urls with the user name inside.
  5. Ensure that all svn working copies and the externals properties in them contains valid svn repository urls with the svn+ssh:// prefix. If not then use the svn relocate https:// svn+ssh:// command to switch onto it. Then fix all the rest urls in the externals properties, for example, just by remove the url scheme prefix and leave the // prefix instead.
  6. Run the pageant.exe in the background with the previously generated private key (add it).
  7. Test the connection to the svn hub server through the putty.exe client. The client should not ask for the password if the pageant.exe is up and running with has been correctly setuped private key. The client should not ask for the user name either if the SVN_SSH environment variable is declared with the user name.

git客户端基本上是已移植的msyscygwin工具的一部分,这意味着它们的行为有所不同.

The git client basically is a part of ported msys or cygwin tools, which means they behaves a kind of differently.

消息Can't create session: Unable to connect to a repository at URL 'svn+ssh://...': Error in child process: exec of '' failed: No such file or directory at .../Git/mingw64/share/perl5/Git/SVN.pm line 310.的问题之一是环境变量SVN_SSH的问题.变量应使用与git相同的工具从相同工具中定义.尝试与putty应用程序中的独立plink.exe一起使用它时,将以该消息结束.

The one of the issues with the message Can't create session: Unable to connect to a repository at URL 'svn+ssh://...': Error in child process: exec of '' failed: No such file or directory at .../Git/mingw64/share/perl5/Git/SVN.pm line 310. is the issue with the SVN_SSH environment variable. The variable should be defined with an utility from the same tools just like the git itself. The attempt to use it with the standalone plink.exe from the putty application would end with that message.

因此,除了svn.exe应用程序的步骤外,还应应用以下步骤:

So, additionally to the steps for the svn.exe application you should apply, for example, these steps:

  1. 删除SVN_SSH环境变量的用法并删除它.
  2. msyscygwin工具运行ssh-pageant(puttypageant必须已经使用有效的私钥运行).例如,您可以从此处阅读: https://github.com/cuviper/ssh-选美
  1. Drop the usage of the SVN_SSH environment variable and remove it.
  2. Run the ssh-pageant from the msys or cygwin tools (the putty's pageant must be already run with the valid private key). You can read about it, for example, from here: https://github.com/cuviper/ssh-pageant

ssh-pageant是Windows的微型工具,它使您可以在Cygwin和MSYS Shell环境中使用PuTTY的Pageant中的SSH密钥.
ssh-pageant is a tiny tool for Windows that allows you to use SSH keys from PuTTY's Pageant in Cygwin and MSYS shell environments.

  1. 从标准输出中创建ssh-pageant返回的环境变量,例如:SSH_AUTH_SOCK=/tmp/ssh-hNnaPz/agent.2024.
  2. 使用git svn ...命令中的url以及文档中所述的用户名(
  1. Create the environment variable returned by the ssh-pageant from the stdout, for example: SSH_AUTH_SOCK=/tmp/ssh-hNnaPz/agent.2024.
  2. Use urls in the git svn ... commands together with the user name as stated in the documentation (https://git-scm.com/docs/git-svn#Documentation/git-svn.txt---usernameltusergt ): svn+ssh://<USERNAME>@svn.<url>.com/repo

--username =< user> 对于SVN处理(http,https和svn)身份验证的传输,请指定用户名.对于其他传输方式(例如svn + ssh://),您必须在URL中包含用户名,例如svn + ssh://foo@svn.bar.com/project
--username=<user> For transports that SVN handles authentication for (http, https, and plain svn), specify the username. For other transports (e.g. svn+ssh://), you must include the username in the URL, e.g. svn+ssh://foo@svn.bar.com/project

这些说明应有助于将git svn命令与svn命令一起使用.

These instructions should help to use git svn commands together with the svn commands.

这篇关于如何在svn + ssh url中使用git-svn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆