2

I am trying to update the contents of a file on github with the following code

file = repo.get_contents('test.csv', ref="main")
data = file.decoded_content.decode("utf-8")
data += "\n test;test;test"
repo.update_file(file.path, "automatic update", data, file.sha, branch='main')

It returns a cryptic error stack with this last line: github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}

the get-method seems to work, as it allows me to print out the original content of the file. Any pointers, why the update_file method is not working?

TIA!

Fildc
  • 33
  • 2
  • If you are using Personal Access Token to access the git repo, I would suggest to double-check that it has write permissions – nismotri Apr 27 '22 at 08:39

0 Answers0