POST /repos/{owner}/{repo}/git/trees
The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.
If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "Create a commit" and "Update a reference."
Returns an error if you try to delete a file that does not exist.
Servers
- https://api.github.com
Path parameters
Name | Type | Required | Description |
---|---|---|---|
repo |
String | Yes |
The name of the repository without the |
owner |
String | Yes |
The account owner of the repository. The name is not case sensitive. |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
tree[] |
Array | Yes |
Objects (of |
tree[].sha |
String | No |
The SHA1 checksum ID of the object in the tree. Also called Note: Use either |
tree[].type |
String | No |
Either Possible values:
|
tree[].content |
String | No |
The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or Note: Use either |
tree[].mode |
String | No |
The file mode; one of Possible values:
|
tree[].path |
String | No |
The file referenced in the tree. |
base_tree |
String | No |
The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.