Skip to content

Traceback when ssh VisualHostKey is used #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
omgjlk opened this issue Mar 2, 2012 · 3 comments
Closed

Traceback when ssh VisualHostKey is used #48

omgjlk opened this issue Mar 2, 2012 · 3 comments
Assignees

Comments

@omgjlk
Copy link

omgjlk commented Mar 2, 2012

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

@dmiyakawa
Copy link

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
Copy link
Member

Byron commented Nov 19, 2014

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.

@Byron Byron added this to the v0.3.5 - bugfixes milestone Nov 19, 2014
@Byron Byron self-assigned this Jan 8, 2015
@Byron Byron closed this as completed in c7887c6 Jan 8, 2015
@Byron
Copy link
Member

Byron commented Jan 8, 2015

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
Development

No branches or pull requests

3 participants