I'm trying to push a new git repo upstream using gitpython module. Below are the steps that I'm doing and get an error 128.
# Initialize a local git repo
init_repo = Repo.init(gitlocalrepodir+"%s" %(gitinitrepo))
# Add a file to this new local git repo
init_repo.index.add([filename])
# Initial commit
init_repo.index.commit('Initial Commit - %s' %(timestr))
# Create remote
init_repo.create_remote('origin', giturl+gitinitrepo+'.git')
# Push upstream (Origin)
init_repo.remotes.origin.push()
While executing the push(), gitpython throws an exception:
'git push --porcelain origin' returned with exit code 128
Access to github is via SSH.
Do you see anything wrong that I'm doing?
I tracked it down with a similar approach:
class ProgressPrinter(git.RemoteProgress):
def line_dropped(self, line):
print("line dropped : " + str(line))
Which you can then call in your code:
init_repo.remotes.origin.push(progress=ProgressPrinter())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With