更新GitLab文件,并使用API​​中包含的.txt文件中包含的数据

发布于 2025-02-05 18:14:34 字数 628 浏览 2 评论 0原文

我正在尝试使用gitlab api在我本地计算机上的文件中包含的数据来更新我的gitlab文件。 到目前为止,我能够通过添加一些文本来更新文件:

curl --request PUT --header "PRIVATE-TOKEN: MY_TOKEN \
  --header "Content-Type: application/json" \
  --data '{"branch": "master",
    "author_email": "[email protected]", "author_name": "someone", "content": "some content", "commit_message": "update file"}' \
    "https://gitlab.server.lan/api/v4/projects/xxxx/repository/files/my_file%2Fmy_yaml_file.yml"

但不能通过添加我喜好的TXT文件的内容。

我会感谢一些帮助!

I am trying to update a gitlab file of mine with data contained in a file on my local machine e.g. /tmp/output.txt using the gitlab API without success so far.
So far I am able to update a file by just adding some text:

curl --request PUT --header "PRIVATE-TOKEN: MY_TOKEN \
  --header "Content-Type: application/json" \
  --data '{"branch": "master",
    "author_email": "[email protected]", "author_name": "someone", "content": "some content", "commit_message": "update file"}' \
    "https://gitlab.server.lan/api/v4/projects/xxxx/repository/files/my_file%2Fmy_yaml_file.yml"

But not by adding the contents of a txt file of my preference.

I would be grateful for some help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文