Trouble pushing to Git remote using GitPython: "remote unpack failed" and "RPC failed; HTTP 500"

27 views Asked by At

I'm encountering issues when trying to push changes to a Git remote repository using GitPython. I'm receiving two different errors intermittently, and I'm unsure how to resolve them.

Error 1

error: failed to push some refs to 'https://github.com/MyName/gitpython-test'

Error 2

  File "c:\Users\User\Documents\doc\pyqt6 app\gitpython-test.py", line 16, in <module>
    origin.push()
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\remote.py", line 1126, in push  
    return self._get_push_info(proc, progress, kill_after_timeout=kill_after_timeout)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\remote.py", line 917, in _get_push_info
    proc.wait(stderr=stderr_text)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\cmd.py", line 657, in wait      
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git push --porcelain -- origin
  stderr: 'error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
fatal: the remote end hung up unexpectedly'

This is the second error I get when I run the program again.

I'm confused because when I run similar commands directly from PowerShell or CMD, they work without any errors. Here's the Python code I'm using:


repo_path = r"C:\\Users\\User\\Documents\\doc\\pyqt6 app\\gitto"
repo = Repo(repo_path)

repo.index.add('.')

repo.index.commit('sad')

origin = repo.remote(name='origin')

origin.push()

I have tried Git push failing HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error answer, but I still get the same error.

0

There are 0 answers