1

I am new to using below command. I have ran this command in git bash but am unable create tag.

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

After execute above command i couldn't found any changes in my repository

my output will like some html output

  <!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 &middot; 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;
3
  • I suspect this not well formatted JSON to be the cause. (JSON is only double quotes, never single ones). But could you please paste command output? (well, after reading it one more time, the single quotes are breaking the -d argument too, so you have to fix it anyway) Commented Oct 6, 2017 at 12:11
  • @Arount its like some html output Commented Oct 6, 2017 at 12:15
  • if i change to api.github.com getting error like "message": "Not Found", How to send request ? Commented Oct 6, 2017 at 12:21

1 Answer 1

2

First of all, you should use api.github.com. Secondly you need to pass the Authorization token into your headers. E.g.

curl -v -H "Authorization: token TOKEN" https://api.github.com/repos/octodocs-test/test

You can find your personal access token on your personal access token page. If you don't have one, you can create one.


So your command may look:

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}'

See: GitHub API v3 | GitHub Developer Guide

Check the available release related endpoints at REST API v3 Releases docs page, e.g.:

  • Get a release by tag name: GET /repos/:owner/:repo/releases/tags/:tag.
  • Create a release: POST /repos/:owner/:repo/releases.
  • etc.

See also: How to use Github Release API to make a release without source code?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.