_pygit2.GitError: authentication required but no callback set
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 408
- Ø Merge
- 2 T. 57 Min.
- Gemergte PRs (30 T.)
- 7
Beschreibung
I'm guessing this is an issue on my end, not really an issue with pygit2, but I've been stuck on it for two days with almost no progress and the documentation isn't making sense to me.
I am trying to push to a repository using user name and password credentials and getting the error:
File "createRepo.py", line 72, in remote.push(['refs/heads/master']) File "/usr/local/lib/python2.7/dist-packages/pygit2/remote.py", line 470, in push check_error(err) File "/usr/local/lib/python2.7/dist-packages/pygit2/errors.py", line 64, in check_error raise GitError(message) _pygit2.GitError: authentication required but no callback set
```
#Clone the newly created repo
repoClone = pygit2.clone_repository(repo.git_url, '/var/www/html/uploads/tmp')
print "GIT URL: "
print repo.clone_url
print "<---"
#Add the new files to the repo
for file in files:
os.rename("/var/www/html/uploads/" + file, "/var/www/html/uploads/tmp/" + file)
#Commit it
repoClone.remotes.set_url("origin", repo.clone_url)
index = repoClone.index
index.add_all()
index.write()
author = pygit2.Signature("MaslowCommunityGardenRobot", "info@maslowcnc.com")
commiter = pygit2.Signature("MaslowCommunityGardenRobot", "info@maslowcnc.com")
tree = index.write_tree()
oid = repoClone.create_commit('refs/heads/master', author, commiter, "init commit",tree,[repoClone.head.get_object().hex])
remote = repoClone.remotes["origin"]
credentials = pygit2.UserPass(userName, password)
remote.credentials = credentials
remote.push(['refs/heads/master'])
The documentation clearly says that there is an optional callback argument push(specs, callbacks=None), but how and when to use that feature is not clear.
If I can get this to work I will post it as a clear, simple example of how to create a repository with pyGitHub, clone it, create a commit, and push it which is something I think is missing.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit createRepo.py etwa bei Zeile 72 und der Dokumentation zu pygit2 remote.push(specs, callbacks=None), und vergleiche anschließend die Zuweisung von UserPass mit der Callback-API. Ermittle, ob die Anleitung oder das Beispiel zur Authentifizierung fehlt, und betrachte das Issue als erledigt, wenn der erforderliche Authentifizierungsablauf für push eindeutig dokumentiert oder demonstriert ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- git, python
- Bereich
- authentication, backend
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100