关键词:
【中文标题】使用 curl 命令发布 git【英文标题】:Using curl command for git release 【发布时间】:2018-03-18 05:40:32 【问题描述】:我不熟悉使用以下命令。我在 git bash 中运行了这个命令,但无法创建标签。
curl -s -k -X POST -H "Content-Type:application/json" "https://github.com/XXXXXX/custom-component/releases?1.2," -d ' "user" : 'email' : 'XXXXXXX', 'password' : 'XXXXX' ,"tag_name": "1.2.1", "target_commitish": "master", "name": "1234", "body": "Release of version 1234", "draft": false, "prerelease": false' -b cookie
执行上述命令后,我在存储库中找不到任何更改
我的输出会喜欢一些 html 输出
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; b-uri 'self'; connect-src 'self'; form-action 'self'; img-src data:; script-srself'; style-src 'unsafe-inline'">
<meta content="origin" name="referrer">
<title>Oh no · GitHub</title>
<style type="text/css" media="screen">
body
background-color: #f1f1f1;
margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
.container margin: 50px auto 40px auto; width: 600px; text-align: cen;
a color: #4183c4; text-decoration: none;
a:hover text-decoration: underline;
h1 letter-spacing: -1px; line-height: 60px; font-size: 60px; font-wei: 100; margin: 0px; text-shadow: 0 1px 0 #fff;
p color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px;
ul list-style: none; margin: 25px 0; padding: 0;
li display: table-cell; font-weight: bold; width: 1%;
.logo display: inline-block; margin-top: 35px;
.logo-img-2x display: none;
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx)
.logo-img-1x display: none;
.logo-img-2x display: inline-block;
#suggestions
margin-top: 35px;
color: #ccc;
【问题讨论】:
我怀疑这不是格式正确的 JSON 的原因。 (JSON 只是双引号,绝不是单引号)。但是你能粘贴命令输出吗? (好吧,再读一遍后,单引号也破坏了-d
参数,所以无论如何你都必须修复它)
@Arount 它就像一些 html 输出
如果我更改为 api.github.com 出现类似 "message": "Not Found" 的错误, 如何发送请求?
【参考方案1】:
首先,您应该使用api.github.com
。其次,您需要将 Authorization token 传递到您的标题中。例如
curl -v -H "Authorization: token TOKEN" https://api.github.com/repos/octodocs-test/test
您可以在your personal access token page 上找到您的个人访问令牌。没有的话可以create一个。
所以你的命令可能看起来:
curl -v -s \
-H "Authorization: token xxxxxxxxx" \
-H "Content-Type:application/json" \
"https://api.github.com/repos/:owner/:repo/releases" \
-d ' "user" : "email" : "XXXXXXX", "password" : "XXXXX", "tag_name": "1.2.1", "target_commitish": "master", "name": "1234", "body": "Release of version 1234", "draft": false, "prerelease": false'
见:GitHub API v3 | GitHub Developer Guide
在REST API v3 Releases docs page查看可用的发布相关端点,例如:
按标签名称获取版本:GET /repos/:owner/:repo/releases/tags/:tag
。
创建版本:POST /repos/:owner/:repo/releases
。
等
另见:How to use Github Release API to make a release without source code?
【讨论】:
cURL 命令在 git bash 中有效,但在 cmd 和 powershell 中无效
】cURL命令在gitbash中有效,但在cmd和powershell中无效【英文标题】:cURLcommandworksingitbashbutnotincmdandpowershell【发布时间】:2020-03-2420:39:54【问题描述】:以下命令在gitbash中有效,但在cmd和powershell中无效curl-XPOSThttp://localhost:5678/api/fin... 查看详情
使用 CURL 将 JSONRPC 命令发布到 pyBitmessage
】使用CURL将JSONRPC命令发布到pyBitmessage【英文标题】:PostingJSONRPCcommandtopyBitmessageusingCURL【发布时间】:2019-01-1310:08:56【问题描述】:我正在尝试使用cprCurl实现将命令发布到C++中的pyBitmessageXML-RPC服务器。像这样:autor=cpr::Post(cpr::... 查看详情
在命令行中使用 curl 通过 JSON 对象发布数据
】在命令行中使用curl通过JSON对象发布数据【英文标题】:PostingdataviaJSONobjectusingcurlinthecommandline【发布时间】:2019-10-2115:59:57【问题描述】:我正在尝试通过命令行将数据从一台服务器发布到另一台服务器。最终,我将使用真实... 查看详情
使用 swift 在 Alamofire 中使用 CURL 命令
】使用swift在Alamofire中使用CURL命令【英文标题】:CURLcommandinAlamofirewithswift【发布时间】:2016-07-2507:58:26【问题描述】:我有以下工作curl命令,我需要使用Alamofire在Swift中运行。curl-k-i-d\'"user":"displayName":"MyTest","email":"test@xxtest.com",... 查看详情
无法在 curl 命令中使用变量 [重复]
】无法在curl命令中使用变量[重复]【英文标题】:Unabletousevariableincurlcommand[duplicate]【发布时间】:2019-08-2703:17:44【问题描述】:我试图在我的ksh程序的curl命令中使用两个变量,但它不起作用。例子:原始网址curl-s--header"Content-Ty... 查看详情
如何使用命令行 curl 显示请求标头
】如何使用命令行curl显示请求标头【英文标题】:Howtodisplayrequestheaderswithcommandlinecurl【发布时间】:2011-03-1605:39:08【问题描述】:命令行curl可以使用-D选项显示响应头,但我想看看它发送的是什么请求头。我该怎么做?【问题... 查看详情
使用 CRON 作业运行 curl 命令
】使用CRON作业运行curl命令【英文标题】:RunacurlcommandusingCRONjobs【发布时间】:2013-07-2422:19:00【问题描述】:我想运行这个语句:curl\'http://localhost:8983/solr/dataimport?command=full-import\'每10分钟使用CRON作业。我如何做到这一点?【问... 查看详情
在 pod 生命周期 poststart 挂钩中使用 curl 命令
】在pod生命周期poststart挂钩中使用curl命令【英文标题】:usingcurlcommandinpodlifecyclepoststarthooks【发布时间】:2021-10-2700:52:19【问题描述】:我正在尝试使用curl为我的pod添加一个poststart挂钩,比如向我的slack频道发送一条消息在shell... 查看详情
使用 curl 命令删除 linux 服务器中的文件
】使用curl命令删除linux服务器中的文件【英文标题】:Deletefileinlinuxserverusingcurlcommand【发布时间】:2018-11-1815:00:55【问题描述】:我想使用curl命令删除我保存在linux服务器中的文件。基本上尝试使用curl实现“rm-rf/myfolder/myFile.zip... 查看详情
如何格式化 Curl 命令以使用 Zapier Webhooks?
】如何格式化Curl命令以使用ZapierWebhooks?【英文标题】:HowdoIformataCurlcommandtoworkwithZapierWebhooks?【发布时间】:2019-11-0417:51:46【问题描述】:我正在尝试在Zapier中使用curl请求。我无法让我的格式适合这种特殊情况。curl-XPOSThttps://p... 查看详情
使用 cURL 注销应用程序
】使用cURL注销应用程序【英文标题】:LogoutofappwithcURL【发布时间】:2014-09-2318:07:12【问题描述】:我们有一个使用RubyonRails构建的Web应用程序,它使用Devise进行登录和注销。我负责使用cURL的后端XMLAPI。用户可以在命令提示符下... 查看详情
有没有办法在 Azure 数据工厂中使用 cURL 命令?
】有没有办法在Azure数据工厂中使用cURL命令?【英文标题】:IsthereawaytousecURLcommandsinAzureDataFactory?【发布时间】:2022-01-0709:15:37【问题描述】:所以我正在尝试在Azure数据工厂中创建一个管道,该过程的一部分涉及将CSV上传到管... 查看详情
从命令行使用 CURL 的 https 连接
】从命令行使用CURL的https连接【英文标题】:httpsconnectionusingCURLfromcommandline【发布时间】:2012-04-2205:01:54【问题描述】:我是Curl和Cacerts世界的新手,在连接服务器时遇到问题。基本上,我需要通过https测试从一台机器到另一台... 查看详情
使用带有 git 的 socks 代理进行 http 传输
】使用带有git的socks代理进行http传输【英文标题】:Usingasocksproxywithgitforthehttptransport【发布时间】:2013-02-2001:12:51【问题描述】:如何让git使用socks代理进行HTTP传输?我成功地使用GIT_PROXY_COMMAND配置git以使用socks代理进行GIT传输... 查看详情
使用 cURL 发布数据时出错
】使用cURL发布数据时出错【英文标题】:ErrorwhenpostingdatawithcURL【发布时间】:2014-09-1518:17:27【问题描述】:我已经编写了以下curl命令。curl-v-XPOST-H\'Accept:application/json\'-H\'Content-Type:application/json\'-uusername:password-d\'Id=5&Email=add@re... 查看详情
使用 PHP 执行 cURL 发送推送通知
】使用PHP执行cURL发送推送通知【英文标题】:UsingPHPtoExecutecURLtosendPushNotification【发布时间】:2017-04-1917:22:42【问题描述】:我正在尝试发送cURL命令来发送推送通知。我对cURL很陌生,似乎无法运行命令。这里是cURL命令行:curl--h... 查看详情
使用代理的 http GET - Curl 命令有效,但 python“请求”库不
】使用代理的httpGET-Curl命令有效,但python“请求”库不【英文标题】:httpGETusingproxy-Curlcommandworksbutpython"requests"librarydoesnot【发布时间】:2017-09-1521:16:51【问题描述】:我有以下工作curl命令:curl-xhttp://<PROXYURL>:3128-umyU... 查看详情
windows有没有类似curl
...里下载curl-7.33.0-win64-ssl-sspi.zip,下载完成之后解压到需要使用curl命令的目录。这里为了方便我先直接解压到当前目录。为了测试curl命令,我已经发布了一个带应用的本地服务器,并且可以在浏览器中访问:打开命令窗口并定位... 查看详情