使用GitPython推送到Git远程时遇到问题:“远程解包失败”和“RPC失败;HTTP 500”
我在用GitPython把更改推送到Git远程仓库时遇到了一些问题。我时不时会收到两个不同的错误,搞得我有点不知所措,不知道该怎么解决。
错误 1
error: failed to push some refs to 'https://github.com/MyName/gitpython-test'
错误 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'
这是我再次运行程序时遇到的第二个错误。
我有点困惑,因为当我直接在PowerShell或CMD中运行类似的命令时,它们都能正常工作,没有任何错误。以下是我使用的Python代码:
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()
我尝试过Git推送失败,HTTP 500 curl 22 请求的URL返回错误:500内部服务器错误中的解决方案,但我仍然遇到同样的错误。
0 个回答
暂无回答