且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Stash(Bitbucket Server)REST API将文件提交到git存储库

更新时间:2022-04-22 04:14:59

可能您正在寻找

PUT/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/browse/{path:.*}

根据API文档

输入/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/browse/{path:.*}

PUT /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/browse/{path:.*}

在给定的存储库和分支上更新路径的内容.这资源接受PUT多部分表单数据,其中包含文件表单域命名的内容.卷曲请求更新示例"README.md"为:

Update the content of path, on the given repository and branch. This resource accepts PUT multipart form data, containing the file in a form-field named content. An example curl request to update 'README.md' would be:

卷曲-X PUT -u用户名:密码-F content=@README.md -F'message =使用文件编辑REST API更新'-F branch = master -FsourceCommitId = 5636641a50b http://example.com/rest/api/latest/projects/PROJECT_1/repos/repo_1/browse/README.md

  • 分支:应在其上修改或创建路径的分支
  • content:路径消息中文件的完整内容:message与该更改相关联,用作提交消息.或为空是否应使用默认消息.
  • sourceCommitId:提交ID文件在编辑之前的大小,用于标识内容是否包含改变了.如果这是一个新文件,则为null.
  • 可以更新文件或在新分支上创建.在这种情况下,sourceBranch参数应该提供以标识新分支的起点而branch参数标识要创建新分支的分支继续.

    The file can be updated or created on a new branch. In this case, the sourceBranch parameter should be provided to identify the starting point for the new branch and the branch parameter identifies the branch to create the new commit on.