1

问题:

10.3.5将 GitLab从分支升级到后9.3.6,如果名称中包含 /,则标记删除 API 将不起作用(示例release/branch)。但它适用于旧版本。

C:\Users\test>curl.exe --request DELETE --header "PRIVATE-TOKEN:token" "https://gitlab.company.com/api/v4/projects/1582/repository/branches/test/test"
{"error":"404 Not Found"}
C:\Users\test>curl.exe --request DELETE --header "PRIVATE-TOKEN:token" "https://gitlab.company.com/api/v4/projects/1582/repository/branches/testz"
C:\Users\test>curl.exe --request DELETE --header "PRIVATE-TOKEN:token" "https://gitlab.company.com/api/v4/projects/1582/repository/tags/tag/test"
{"error":"404 Not Found"}
C:\Users\test>curl.exe --request DELETE --header "PRIVATE-TOKEN:token" "https://gitlab.company.com/api/v4/projects/1582/repository/tags/tagtest"

在上面的 curl 数据中,我可以删除分支testz,但也会test/test抛出错误 Same in tag。如何通过 API 删除这些分支?

4

1 回答 1

2

因为它是一个 URL,所以有些字符不能在上下文之外使用。例如,_space_即使该区域表示字符串,URL 的中间也不能有 a,因此您必须使用%20而不是_space_

对于test/test,您可能需要替换/%2F

所以测试%2Ftest

于 2018-07-11T14:12:31.723 回答