Skip to content

AttributeError: 'PushInfo' object has no attribute 'push_infos' [SOLVED] #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gmelodie opened this issue Jul 11, 2021 · 0 comments
Closed

Comments

@gmelodie
Copy link

Leaving this here in case someone else has the same issue

Python version: 3.8
GitPython version: 3.1.18

Code I'm trying to run:

repo = Repo(".")
repo.git.add(all=True)
print("git add --all")
commit_msg = get_commit_msg()
repo.index.commit(commit_msg)
print(f"git commit -m \"{commit_msg}\"")
info = repo.remotes.origin.push()
print(info.summary)

Full error message:

Traceback (most recent call last):
  File "lazycommit.py", line 28, in <module>
    print(info.summary)
  File "/home/gmelodie/.local/lib/python3.8/site-packages/git/util.py", line 970, in __geta
ttr__
    if getattr(item, self._id_attr) == attr:
AttributeError: 'PushInfo' object has no attribute 'push_infos'

Solution

I was using info = repo.remotes.origin.push() when instead I should be using info = repo.remotes.origin.push()[0] (origin.push() returns a list of info objects, each object for a particular head that was pushed, but we often push only one head)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant