0

I am using pygit2 to create a branch on a remote repository. If it was in a local repository i would've used :

repo=pygit2.Repository(repo_url)                                                  
repo.create_branch('branch1', repo.head.get_object(), force=False)

But when i give the function Repository a remote url (not a path) it doesn't work, is there a solution ?

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
mohamed wael thabet
  • 195
  • 2
  • 4
  • 12

1 Answers1

0

You will have to create your branch locally and then push it to the remote. Once its pushed you can add remote with the branch name to track it locally (required on older git versions prior to 1.9).

The push command is here.


git push --set-upstream <remote> <branch>
CodeWizard
  • 128,036
  • 21
  • 144
  • 167