JDBC Driver for GitHub

Build 24.0.9060

UploadFile

Upload a file to a repository.

Sample

The 'Path' parameter is required, and must be relative to the repository root without a preceding '/'.

EXECUTE  [Repository_MyRepository].[UploadFile] Path='testFileUploadFromProcedure.txt', LocalPath='C:/Users/CData/Desktop/project/file.txt', CommitMessage='test'

Alternatively, set the connection property Schema to the desired repository.

EXECUTE [UploadFile] Path='testFileUploadFromProcedure.txt', LocalPath='C:/Users/CData/Desktop/project/file.txt', CommitMessage='test'

EXECUTE  [UploadFile] Repository='HelloGit', Path='src/Main.java', FileData='aGVsbG8gd29ybGQh', CommitMessage='test', Branch='master', CommitterName='CData', CommitterEmail='[email protected]', AuthorName='CDataSupport', AuthorEmail='[email protected]'

Set SHA to replace an existing file.

EXECUTE  [UploadFile] Repository='HelloGit', Path='src/Main.java', FileData='aGVsbG8gd29ybGQh', CommitMessage='test', SHA='bc7774a7b18deb1d7bd0212d34246a9b1260ae17'

Input

Name Type Accepts Output Streams Description
Path String False The file path, relative to the repository root.
Branch String False The branch to download the file from. Defaults to 'main'.

The default value is main.

CommitMessage String False The commit message for the file upload.
SHA String False The file hash, used to update existing files.
CommitterName String False The name of the person that committed the file. Default: the authenticated user.
CommitterEmail String False The email of the person that committed the file. Default: the authenticated user.
AuthorName String False The name of the author that committed the file. Default: the committer or the authenticated user if you omit committer.
AuthorEmail String False The email of the author that committed the file. Default: the committer or the authenticated user if you omit committer.
LocalPath String False The absolute path where the file data is read from.
InputStream Binary True An instance of an input stream where file data is read from. Only used if LocalPath is not set.
FileData String False Base64 string representation of the file content. Only used if LocalPath and InputStream are not set.

Result Set Columns

Name Type Description
Success Boolean Indicates whether or not the operation executed successfully.
Details String Any extra details on the operation's execution.
CommitSHA String The commit hash.
FileSHA String The file node hash.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060