PyGithub / PyGithub/PyGithub

Why is my repo object's master_branch property None?

Aperta
#3,007 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
7.8k
Fork
1.9k
Merge medio
17m
PR unite (30g)
2

Descrizione

Hello,

I'm trying to programatically get the name of the master branch of my repo. To do this I'm trying to access the master_branch property in Repository but even though the documentation says it should return a string, I get back None regardless of the repo I've checked.

The repos are all private work-related repos so I can't share the exact code here but basically what I'm doing is:

>>> import github
>>> gh = github.Github("ACCESS_TOKEN_REDACTED")
>>> org = gh.get_organization("ORG_NAME_REDACTED")
>>> repo = org.get_repo("REPO_NAME_REDACTED")
>>> branch = repo.master_branch
>>> branch is None
True

Does this suggest I've configured my repo incorrectly? Or am I misunderstanding how to properly use the library?

Thanks in advance. Please let me know what other information might be helpful for troubleshooting.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Start at the Repository.master_branch entry point and compare its documented behavior with the GitHub API response for a private repository. Check the reported reproduction against the current library and API behavior; done means identifying whether the property or its usage needs correction and documenting a concrete resolution.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.