bitbucket - Bitbucket 服务器 REST Api 更改文件
问题描述
在 Bitbucket 的文档中,有关于如何通过 Rest API 更改文件的信息:
curl -X PUT -u username:password \ -F content=@README.md \ -F 'message=Updated using file-edit REST API' \ -F branch=master \ -F sourceCommitId=5636641a50b \ http://example.com/rest/api/latest/projects/PROJECT_1/repos/repo_1/browse/README.md
branch:应该在其上修改或创建路径的分支
content : 路径下文件的全部内容
message:与此更改关联的消息,用作提交消息。如果应该使用默认消息,则为 null。
sourceCommitId:文件编辑前的提交 ID,用于识别内容是否发生变化。如果这是一个新文件,则为 null
但是当我调用我的脚本时:
curl -k -X PUT \
-H "Authorization: Basic cnVhtrhjrthhtUUFaeHN3Mg==" \
-F content=@README.md \
-F "message=Updated using README" \
-F branch=master \
https://bitbucket.company.com/rest/api/1.0/projects/project_name/repos/repo_name/browse/README.md
我收到这条消息:
Warning: setting file README.md failed!
curl: (26) read function returned funny value.
可能是什么问题呢?
解决方案
正确要求:
curl -X PUT -u 用户名:密码 -F content=一些更改-F 'message=使用文件编辑 REST API 更新' -F branch=master -F sourceCommitId=5636641a50b http://example.com/rest/api/最新的/projects/PROJECT_1/repos/repo_1/browse/README.md
内容应该没有@
推荐阅读
- google-cloud-dataflow - Apache Beam - 仅滑动窗口发出最早的活动窗口
- javascript - (S)CSS 中的 JS Sapper + Bulma 断点
- java - 找到“平衡数”的算法 - 相同数量的偶数和奇数除法器
- python - 增加一个变量并存储该值?Python
- python-2.7 - 名称错误:未定义名称“pynative”
- xml - SQL 返回 XML 并需要在屏幕上显示
- scala - 如何使用 Play 和 sbt 在 CI 中使用单独的配置文件进行测试?
- ansible - 如何在 Ansible 中比较多个文件
- graph - MPI:具有可变进程数的二叉树拓扑
- javascript - 如何在 Angular 9 中正确安装预建模板