Can't clone on windows but can clone on linux from Gitlab server

非 Y 不嫁゛ 提交于 2019-12-01 10:56:26

Note: I just upgrade to Git 2.14.0 for Windows... and none of the ssh url are working:

> git ls-remote
GitLab: Disallowed command
fatal: Could not read from remote repository.

(with origin being an ssh url)

Another side effect: git-for-windows/git issue 1258

fatal: protocol error: bad line length character: Not

It looks as if BitBucket looks at argv[0] (typically git-upload-pack, with the regression git) to determine whether it is a permitted command.

So I think it is by design that git is rejected while git-upload-pack is not.

Same kind on error on GitLab: gitlab-ce issue 36028.
The pending merge request explicitly restore git-xxx when it detects a git xxx command.

See gitlab_shell.rb#parse_cmd(args)

  def parse_cmd(args)
    # Handle Git for Windows 2.14 using "git upload-pack" instead of git-upload-pack
    if args.length == 3 && args.first == 'git'
      @command = "git-#{args[1]}"
      args = [@command, args.last]
    else
      @command = args.first
    end

At the Git for Windows side, a fix is in progress: see commit 0f33428

Revert "git_connect: prefer Git's builtins over dashed form"

It would appear that this change (which was intended to fix tests interacting with local repositories when git-upload-pack was not in the PATH) regresses on SSH access.

A Git for Windows 2.14.0(2) is in the work and was just released (2017-08-07T11:05:34Z UTC) 30 minutes ago at the time of this edit.


Original answer

If key1 is the same as your /path/to/.ssh/key and does identify John Doe, that should mean John Doe does not have access to that repo (as in here).
Check that key2 is associated with a different user.

If both keys reference the same user, then it is more a local configuration issue (as in this answer). Check also that your TortoiseGit does use the same key as in your test:

set "GIT_COMMAND_SSH=ssh -v"
# launch TortoiseGit from that CMD session

You will then see what TortoiseGit is using when cloning the repo with an ssh url. You might need to define an .ssh/config file.

Both Bitbucket Server and Gogs are seeing similar problems.

It appears that something changed in git 2.14.0 (possibly only on Windows) that requires either an update to the products or a fix to git.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!