【问题标题】:git svn branch results in Authentication failedgit svn 分支导致身份验证失败
【发布时间】:2016-04-09 22:50:59
【问题描述】:

我正在尝试通过 git-svn 进行所有分支和合并,但是我在 subversion 中挂断了分支。

我们的管理员告诉我,我对 repo 拥有完整的读/写权限,并且我可以获取最新的代码。

为了测试,我删除了我的 ~/.subversion/svn.simple 目录并运行了这个。

04:13 pm [214423L] C:\Dev\MyFooApp.Bar [master]
$ git svn fetch
Authentication realm: <https://code:443> VisualSVN Server
Password for 'cflorell': {my password}

04:14 pm [214423L] C:\Dev\MyFooApp.Bar [master]
$ git svn fetch

04:14 pm [214423L] C:\Dev\MyFooApp.Bar [master]
$

另外,如果我使用 Tortoise 克隆 repo,然后使用 svn 创建一个分支,它似乎可以工作。

04:43 pm [214423L] C:\Dev\MyFooApp.Bar
$ svn copy https://code/svn/MyFooApp.Bar/trunk https://code/svn/MyFooApp.Bar/branches/test-branch -m "test branch"
Committing transaction...
Committed revision 93.

但在尝试使用git-svn 创建分支时,它仍然说我的身份验证无效。

04:14 pm [214423L] C:\Dev\MyFooApp.Bar [master]
$ git svn branch develop
Copying https://code/svn/MyFooApp.Bar/trunk at r92 to https://code/svn/MyFooApp.Bar/branches/develop...
Authentication failed: Unable to connect to a repository at URL 'https://code/svn/MyFooApp.Bar/trunk': No more credentials or we tried too many times.
Authentication failed at C:\Program Files\Git\mingw64/libexec/git-core\git-svn line 1196.

04:14 pm [214423L] C:\Dev\MyFooApp.Bar [master]
$

我的config 文件我相信是正确的。

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[svn-remote "svn"]
    url = https://code/svn/MyFooApp.Bar
    fetch = trunk:refs/remotes/svn/trunk
    branches = branches/*:refs/remotes/svn/*
    tags = tags/*:refs/remotes/svn/tags/*

所有这些我可能哪里出错了?

【问题讨论】:

  • 你解决过这个问题吗?我遇到了类似的事情,不得不求助于使用 svn 客户端来创建标签分支,因为我想不出办法过去。
  • 我从来没有这样做过,我说服我们的公司搬到 GIT。
  • 看在你的份上,我为这个结果感到高兴!不幸的是,Wordpress 插件库似乎需要 Subversion 来部署插件,刚刚通过 r1360603,没有显示出放缓的迹象,而且我没有说服它迁移到 DVCS 的影响力。
  • 我也遇到了这个问题,但还没有弄清楚为什么,我能够推送到 svn 服务器,我能够从服务器中提取。然而,Git SVN 分支命令每次也会给我同样的错误。
  • 我陷入了完全相同的境地。花了最后一个小时试图弄清楚如何在 WP 插件 repo 上标记一个简单的版本,仍然无济于事......

标签: git-svn


【解决方案1】:

所以看起来 Tortoise SVN 和 git-svn 之间存在冲突,我不确定这是否存在于其他版本的 SVN 中,但我卸载了 Tortoise SVN,然后能够使用 git svn branch branchName

C:\Files\Source\Repos\applications\core\App01>git svn branch branchName
Copying http://url/svn/company/applications/core/App01/trunk
 at r7071 to http://url/svn/company/applications/core/App01/
branches/branchName...
Found possible branch point: http://url/svn/company/applications/core/App01/trunk => http://url/svn/company/applications/core/App01/branches/branchName, 7071
Found branch parent: (refs/remotes/origin/branchName) f8ba2fd450c30d4812b7549217eae1b2d5c7dd00
Following parent with do_switch
Successfully followed parent
r15037 = 52dd759833fd89c7be03f89093aba38090b3288f (refs/remotes/origin/branchName)

C:\Files\Source\Repos\applications\core\App01>

暂时去试试其他的SVN浏览器,看看是否也有问题。

【讨论】:

  • 这与我在尝试切换到 git-svn 之前也运行 Tortoise SVN 的事实一致。
  • 我在 Linux 上,除了 git 命令行工具之外从未使用过任何东西,Tortoise 对我来说并没有参与其中。
  • 我之前安装了 TortoiseGit,这很有效;我最近格式化了我的电脑,重新安装了相同的实用程序套件,现在遇到了这个问题。所以虽然我有一个 Tortoise 实用程序,但它不是 Tortoise SVN(它肯定可以与之前安装的它一起使用)......
  • 我的经验是这样的:我安装了 TortoiseSVN,然后我为 Windows 安装了 git,包括 git-bash,使用 git-svn 运行良好,然后我更新了 TortoiseSVN,然后 git-svn 开始了这种行为 Un-将 TortoiseSVN 恢复功能安装到 git-svn。
【解决方案2】:

根据https://gist.github.com/kasparsd/3749872/563011118e33900b3a0ca89ec37f3c99be8e9c49 ,无法使用 git svn 标签进行身份验证(曾经工作,但停止工作)。

改为直接使用svn提交标签:

svn cp <trunk-ul> <tag-url> -m "creating tag x.x"

它会要求以纯文本形式存储您的密码。

【讨论】:

    【解决方案3】:

    请注意,一年多后(2017 年 3 月),Git 2.13+(2017 年第二季度)应该避免 git svn 身份验证问题。

    commit e0688e9(2017 年 3 月 6 日)Hiroshi Shirosaki (shirosaki)

    它通过svn branch 识别身份验证失败,而svn rebasesvn dcommit 工作正常而没有身份验证失败。

    $ git svn branch v7_3
    Copying https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx at r27519
    to https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/v7_3...
    Can't create session: Unable to connect to a repository at URL
    'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': No more
    credentials or we tried too many times.
    Authentication failed at
    C:\Program Files\Git\mingw64/libexec/git-core\git-svn line 1200.
    

    我们将身份验证配置添加到SVN::Client-&gt;new() 以解决此问题。

    【讨论】:

    • 这个 bug 在 Git 2.7.4 中仍然存在 :-(
    • @StevenByks 这是可能的。 2.7 早于 2.13。 2.7 是通常在 Ubuntu 14.04 中找到的版本吗?你能升级 Git 吗?
    • 我将 2.13 读作 2.1.3,操作!我在 Ubuntu 16.04 LTS 上,遗憾的是 2.7.4 是发行版。但是我使用 ppa 升级到了 2.18,现在可以使用了!
    猜你喜欢
    • 2017-04-11
    • 2013-07-13
    • 2015-03-13
    • 2021-01-10
    • 1970-01-01
    • 2014-08-24
    • 2018-11-05
    • 2016-09-29
    • 2017-08-16
    相关资源
    最近更新 更多