Skip to content

ValueError raised instead of GitCommandError when not authenticated #424

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
stuaxo opened this issue May 6, 2016 · 4 comments
Closed

ValueError raised instead of GitCommandError when not authenticated #424

stuaxo opened this issue May 6, 2016 · 4 comments
Assignees
Labels

Comments

@stuaxo
Copy link

stuaxo commented May 6, 2016

I have a git repo that needs a key, if I don't enter the password for the key, when using Repo.clone_from or Repo.pull GitCommandError isn't raised.

  File "/home/stu/.virtualenvs/ng/local/lib/python3.5/site-packages/git/cmd.py", line 319, in wait
    raise GitCommandError(self.args, status, self.proc.stderr.read())
ValueError: read of closed file

^ which is because proc.stderr is closed at this point.

To reproduce, clone from a git repo using a key + a uri like

[email protected]:blah/blah.git

Then when it prompts you to unlock the key, just press enter (not unlocking) it - similar thing for pull as well.

@stuaxo
Copy link
Author

stuaxo commented May 6, 2016

Ideally there would be some sort of GitCommandError that let me know the key wasn't authenticated.

@stuaxo
Copy link
Author

stuaxo commented May 6, 2016

Or possibly GitPython could use paramiko somehow here.

@Byron Byron self-assigned this May 19, 2016
@Byron Byron added the rejected label May 19, 2016
@Byron
Copy link
Member

Byron commented May 19, 2016

Thanks for reporting. When trying to reproduce it, I got the following stacktrace:

/Users/byron/Documents/dev/bdep-oss/lib/git-python/0.3/noarch/git/cmd.py in wait(self, stderr)
    326             if status != 0:
    327                 errstr = read_all_from_possibly_closed_stream(self.proc.stderr)
--> 328                 raise GitCommandError(self.args, status, errstr)
    329             # END status handling
    330             return status

GitCommandError: 'git clone -v [email protected]:blah/blah.git blah' returned with exit code 128
stderr: 'Cloning into 'blah'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
'

In [30]:

In the latest version, v2.0.2, the issue seems to be fixed, as GitCommandError is thrown as expected.

@Byron Byron closed this as completed May 19, 2016
@stuaxo
Copy link
Author

stuaxo commented May 19, 2016

Cheers :)

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

No branches or pull requests

2 participants