Skip to content
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

Unable to push #456

Closed
KINFOO opened this issue Dec 2, 2014 · 7 comments · Fixed by #462
Closed

Unable to push #456

KINFOO opened this issue Dec 2, 2014 · 7 comments · Fixed by #462

Comments

@KINFOO
Copy link
Contributor

KINFOO commented Dec 2, 2014

Hi,

I am using pygit2==0.21.4. I try to push using KeypairFromAgent and I am having a Traceback. Here is my code:

from pygit2 import KeypairFromAgent, Repository

repository = Repository( '/home/kevin/.bee/repositories/bee_test_repository' )
signature = repository.default_signature
credentials = KeypairFromAgent('git')

for remote in repository.remotes:
    remote.credentials = credentials
    remote.push_url = remote.url
    print ('push url: {}'.format(remote.push_url) )
    remote.push('refs/heads/i18n', signature, 'Pushed!')

Here comes the Traceback:

$ python /tmp/sshkeypairfromagent.py
push url: ssh://[email protected]:7999/avtools/bee_test_repository.git
Traceback (most recent call last):
  File "/tmp/sshkeypairfromagent.py", line 11, in <module>
    remote.push('refs/heads/i18n', signature, 'Pushed!')
  File "/home/kevin/.virtualenvs/bee/lib/python3.4/site-packages/pygit2/remote.py", line 358, in push
    check_error(err)
  File "/home/kevin/.virtualenvs/bee/lib/python3.4/site-packages/pygit2/errors.py", line 56, in check_error
    raise GitError(message)
_pygit2.GitError: This transport isn't implemented. Sorry

I have read bugs #424 and #379 and tests. I still do not get what I am doing wrong. Any clue?

Kevin

@carlosmn
Copy link
Member

carlosmn commented Dec 5, 2014

You need to have the development files for libssh2 are available when building libgit2, or it won't be able to connect via ssh.

@KINFOO
Copy link
Contributor Author

KINFOO commented Dec 10, 2014

So, I was doing wrong, thanks Carlos.

I read it somewhere in the docs but unfortunately assumed that I had libssh2 development files installed...

Do you think it woth adding a trouble shooting_ section in push docs. I could provide a pull request for it.

Thanks a lot

@KINFOO
Copy link
Contributor Author

KINFOO commented Dec 10, 2014

I am using default_signature to push in the following:

#!/bin/env python
from pygit2 import KeypairFromAgent, Repository

repository = Repository('/home/kevin/.bee/repositories/bee_test_repository')
remote = repository.remotes[0]
remote.credentials = KeypairFromAgent('git')
remote.push_url = remote.url
print('Signature type: {}'.format(repository.default_signature))
print('Push url: {}'.format(remote.push_url))
remote.push('refs/heads/i18n', repository.default_signature, 'Hourray')

But default_signature does not seem to suffice:

$ python /tmp/push.py
Signature type: <_pygit2.Signature object at 0x7f1e1ccd43f0>
Push url: ssh://[email protected]:7999/avtools/bee_test_repository.git
Traceback (most recent call last):
  File "/tmp/push.py", line 10, in <module>
    remote.push('refs/heads/i18n', repository.default_signature, 'Hourray')
  File "/home/kevin/.virtualenvs/bee/lib/python3.4/site-packages/pygit2/remote.py", line 378, in push
    err = C.git_push_update_tips(push, ptr, to_bytes(message))
TypeError: initializer for ctype 'git_signature *' must be a cdata pointer, not bytes

Am I (again) missing something out?

Kevin

@jdavid
Copy link
Member

jdavid commented Dec 10, 2014

Regarding the documentation, I would document it in the requirements section of the install page, see http://www.pygit2.org/install.html#requirements

A PR would be very much appreciated.

@carlosmn
Copy link
Member

If you're going to use the default signature, you might as well pass None which should also help work around the type mismatch.

@KINFOO
Copy link
Contributor Author

KINFOO commented Dec 11, 2014

@carlosmn Works like a charm.

I will use this issue for installation documentation PR.

Thanks for the awesome work.
Kevin

KINFOO added a commit to KINFOO/pygit2 that referenced this issue Dec 19, 2014
It has to be available when building `libgit2`.
Fixes libgit2#456
@KINFOO
Copy link
Contributor Author

KINFOO commented Dec 19, 2014

Tell me if the previous suffice.

I tried to find which version of libss2 is compliant with libgit2 but could not get this information form its CMakeLists.

I am available for any PR improvement.

Kevin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants