Unable to push to remote after committing files
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start by inspecting the repository's configured origin URL and the remote.push call, then verify how the provided RemoteCallbacks and UserPass credentials are used. Reproduce the unsupported URL protocol error with the shown pygit2 code and compare the remote configuration with supported protocols. Done means identifying the configuration or callback issue and documenting a verified successful push.
Written by the indexing model from the issue text.
Description
I am committing some files using pygit2 and want to push to remote branch.
This is what i am doing:
repo = pygit2.Repository(build_dir)
branch = repo.lookup_branch(local_branch)
repo.checkout(branch)
for fl in files:
repo.index.add(fl)
repo.index.write()
message = f"Commiting files {files}"
tree = repo.index.write_tree()
parent, ref = repo.resolve_refish(refish=repo.head.name)
author = pygit2.Signature("user", "email")
commiter = pygit2.Signature("user", "email")
repo.create_commit(
ref.name,
author,
commiter,
message,
tree,
[parent.oid],
)
remote = repo.remotes["origin"]
callbacks = pygit2.RemoteCallbacks(pygit2.UserPass("username", GITHUB_PERSONAL_ACCESS_TOKEN))
remote.push(['refs/heads/master'],callbacks=callbacks)
And i get an error:
_pygit2.GitError: unsupported URL protocol
I cannot find any documentation or any clarity on whats going on here.
Any help will be much appreciated.
thanks
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libgit2/pygit2
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·