0

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.

2
  • Do you have a proxy between you and GitHub? Commented Mar 29, 2024 at 16:56
  • I do not, I only made a public repository in Github for test then cloned it with GitPython, but I have trouble using the push method as I mentioned above :( Commented Mar 29, 2024 at 17:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.