Using the git module,this code works fine on windows
def actionGitPush(self,message_label,dir):
repo = git.Repo(dir )
origin_url = repo.remotes.origin.url
#print(repo)
repo.remotes.origin.push(refspec='master:master')
message_label.append('Git Push to ' + origin_url )
message_label.append('==========')
but it gives this error on ubuntu.
Traceback (most recent call last):
File "/media/vbk/MAsTOCK/_PROJECT/_utils/scripts/python/devmgmt/devmgmt.py", line 234, in actionGitPush
repo.remotes.origin.push(refspec='master:master')
File "/home/vbk/.local/lib/python3.9/site-packages/git/remote.py", line 1118, in push
return self._get_push_info(proc, progress, kill_after_timeout=kill_after_timeout)
File "/home/vbk/.local/lib/python3.9/site-packages/git/remote.py", line 927, in _get_push_info
proc.wait(stderr=stderr_text)
File "/home/vbk/.local/lib/python3.9/site-packages/git/cmd.py", line 604, in wait
raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git push --porcelain -- origin master:master
stderr: 'fatal: could not read Username for 'https://github.com': No such device or address'
I can't figure what's going on.
source https://stackoverflow.com/questions/77122801/python-git-push-function-works-only-on-windows
Comments
Post a Comment