Create a reference
Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches.
POST
/repos/{owner}/{repo}/git/refs- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
Body Params
requiredapplication/jsonobject
key string
optionalExample: "refs/heads/newbranch"
ref string
requiredThe name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
sha string
requiredThe SHA1 value for this reference.
Responses
application/json Git Reference object
Response
Headers
Location string
Example: https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA
node_id string
required object objectrequired
object object
requiredsha string
requiredSHA for the reference
Example: 7638417db6d59f3c431d3e1f261cc637155684cd
type string
requiredurl string<uri>
requiredref string
requiredurl string<uri>
requiredapplication/json Validation Error object
Validation failed
documentation_url string
required errors array[object]optional
errors array[object]
optional items object
items object
code string
requiredfield string
optionalindex integer
optionalmessage string
optionalresource string
optionalvalue
optionalmessage string
required