In order to understand how blobs work in Github API, I tried to create a blob with showing in the below poster, I got 201 created in the response, but in my github repository I say nothing about this blob. I don't understand how the blob works here, my expected function of the blob is that it allows me to push a file to the repository, basically what I want to achieve is use github API to push files to the repository, how to do this with the blob API?
my expected function of the blob is that it allows me to push a file to the repository
Git doesn't ever push files. It pushes commits. And Git blobs are pretty low-level.
I think you're using the wrong API endpoint. The contents
endpoint lets you create files:
Create a file
This method creates a new file in a repository
PUT /repos/:owner/:repo/contents/:path
Parameters
- path (string, required): The content path
- message (string, required): The commit message
- content (string, required): The new file content, Base64 encoded
- branch (string): the branch name. Default: the repository’s default branch (usually
master
)Optional Parameters
You can provide an additional
committer
parameter, which is an object containing information about the committer. Or, you can provide anauthor
parameter, which is an object containing information about the author.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With