_pygit2.GitError: authentication required but no callback set
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.7k
- Fork
- 408
- Merge medio
- 2g 57m
- PR unite (30g)
- 7
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con createRepo.py intorno alla riga 72 e con la documentazione di pygit2 remote.push(specs, callbacks=None), quindi confronta l’assegnazione di UserPass con la callback API. Determina se manca la guida o l’esempio per l’autenticazione e considera l’issue completata quando il flusso di autenticazione richiesto per push è documentato o dimostrato chiaramente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- git, python
- Ambito
- authentication, backend
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100