Skip to content

Traceback when ssh VisualHostKey is used #48

Closed
@omgjlk

Description

@omgjlk

https://bugzilla.redhat.com/show_bug.cgi?id=773640 is where this bug came in.

Description of problem:
If you have VisualHostKey turned on in .ssh/config and you try to access a git
repo via ssh in GitPython, GitPython will fail.

Version-Release number of selected component (if applicable):
GitPython-0.3.2-0.1.RC1.fc14.noarch
(Rebuilt from the current sources in master)

How reproducible:
Everytime

Steps to Reproduce:

  1. echo 'VisualHostKey yes' >> ~/.ssh/config
  2. git clone ssh://git.fedorahosted.org/git/fas
  3. python
  4. import git
  5. repo = git.Repo('fas')
  6. repo.remotes.origin.fetch()

Actual results:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in
repo.remotes.origin.fetch()
File "/usr/lib/python2.7/site-packages/git/remote.py", line 593, in fetch
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
File "/usr/lib/python2.7/site-packages/git/remote.py", line 539, in
_get_fetch_info_from_stderr
assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)"
% (fetch_head_info, fetch_info_lines)
AssertionError: len(["0fd7e783141916845432f94d8ee7c2e8a34c02f9\t\tbranch
'master' of ssh://fedorapeople.org/~toshio/public_git/gitsync\n"]) !=
len(['Host key fingerprint is 07:d4:02:db:9f:70:d5:2d:7f:1b:6a:df:83:73:95:1d',
'+--[ RSA 2048]----+', '| .... .. . |', '| +. .. o .|', '| .
+.. o |', '| = . Eo|', '| S + . B|', '| . o
oo|', '| . o o|', '| o +.|', '| o .|',
'+-----------------+', '', '', ' = [up to date] master ->
origin/master'])

Expected results:
The remote repository is fetched

Activity

dmiyakawa

dmiyakawa commented on Aug 26, 2013

@dmiyakawa

I encountered a similar issue with different causes. Looks like refs #32 is similar in its root cause.

I think the most important problem here is that the assertion doesn't take care of strerr output coming from ssh command (outside this tool, obviously). If ssh says "Warning: Permanently added the RSA host key for IP address", this assertion will fail in exactly same manner.

I saw this (kind of) problem when using GitPython in a batch tool a few times, where the counterpart is github, which has changed their IP address for a domain (legitimately).

Byron

Byron commented on Nov 19, 2014

@Byron
Member

The assertion is gone already, which might make your case work right away. You could try the latest version on pypi.
If I don't get feedback here, I will verify this when working on 0.3.5.

added this to the v0.3.5 - bugfixes milestone on Nov 19, 2014
self-assigned this
on Jan 8, 2015
Byron

Byron commented on Jan 8, 2015

@Byron
Member

I was able to reproduce the issue and improve the parsing to the point where it can properly handle these visual key stamps (by ignoring them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Byron@omgjlk@dmiyakawa

      Issue actions

        Traceback when ssh VisualHostKey is used · Issue #48 · gitpython-developers/GitPython