gitgithubdulwich

"git push origin master " in Dulwich


I am new to git and python and I was trying to do :

git push origin master using Dulwich

I have cloned a remote repository to local repo "local_repo" and then trying to do something like:

porcelain.push(local_repo,'git://github.com/myusername/myrepo')

and it shows error:

"dulwich.errors.GitProtocolError: You can't push to git://github.com/myusername/myrepo Use https://github.com/myusername/myrepo.git"

When I use :

porcelain.push(local_repo,'https://github.com/myusername/myrepo.git')

It shows error:

"dulwich.errors.GitProtocolError: unexpected http response 401"

Please tell me how do I go about it


Solution

  • You can't push to that repository as you don't have the necessary permissions. You can pass the ceredentials as part of the URL if you like:

    git clone https://username:password@github.com/username/repository.git
    

    I would use an ssh key for github though.

    EDIT: It seems like porcelain has a bug working with private repositories. I've opened an issue here: https://github.com/jelmer/dulwich/issues/507