Seems like it\'s missing from the \"Repos\" docs for v1, v2, and v3...how do I create a branch using the Github API?
This is a common problem for all the students when we create API for creating a branch in GitHub
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}
For solving this error during create repository in Github.....
First create a personal token in
Github=>setting=>developerOption=>generatePersonalToken...
or
during gitLogin bu Oauth when you pass client_id that time you pass scope=repo(Because it's allow all the Repository when you used token or anything)
After that: hit the API(get)
https://api.github.com/repos/
You got a response which is like
Response => {
[
{
"ref": "refs/heads/",
"node_id": "jkdhoOIHOO65464edg66464GNLNLnlnnlnlna==",
"url": " https://api.github.com/repos///git/refs/heads/",
"object": {
"sha": "guDSGss85s1KBih546465kkbNNKKbkSGyjes56",
"type": "commit",
"url": " https://api.github.com/repos///git/commits/guDSGss85s1KBih546465kkbNNKKbkSGyjes56"
}
}
]
}
Complete this process again hit API (Post)
https://api.github.com/repos/Bhupi2508/Test/git/refs...
And send data in JSON format like this:
{
"ref": "refs/heads/",
"sha": "4661616ikgohlKIKHBK4634GRGSD66"
}
THEN YOU CREATE A BRANCH IN GITHUB By APIs
And the process for Delete Branch hit only DELETE (first) APIs