PyGithub / PyGithub/PyGithub

GithubException 422 when try to update a file in the Github repository.

Open
#2,281 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
1.9k
Avg merge
17m
Merged PRs (30d)
2

Description

Hi!, I get the follow error message when try to update a file in the repository:
github.GithubException.GithubException: 422 {"message": "Invalid request.\n\n"sha" wasn't supplied.", "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}.
I attach a screenshot of the code
Immagine 2022-07-27 100640
.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the code in the attached screenshot and the GitHub create-or-update-file-contents API documentation linked in the error. Check how the update request handles the required "sha" value, then reproduce the 422 response. Done means the file update request succeeds without the missing-sha error.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.