Does git provide a REST API for fetching the output of the gits status command. I looked up the https://developer.github.com/v3/ but couldn't find what I am looking for. I want to get all the text output that gets displayed when we type in the git status command in the command prompt/git bash terminal and then be able to display that output on a webpage /application window.
Asked
Active
Viewed 446 times
1
-
1I'm not sure it makes to have that in the API. The [official documentation for that command](https://git-scm.com/docs/git-status) is "Show the working tree status". What would you expect the server to say? – Ray Toal May 08 '19 at 20:23
-
@RayToal to put in other words: I would like to display the exact output that git terminal shows when I type in the git status command. Or atleast something that could give me details like changes to be commited, untracked files, current branch, etc just as the original console displays it. – Asif Kamran Malick May 08 '19 at 20:30
-
I think I understand that, but if you call GitHub's API, the endpoint on the server will not know your local information. Pretty much all that information is computed within the `git` executable on your local machine; none of that (or very very little perhaps) is done via the GitHub API. Hope that makes sense. – Ray Toal May 08 '19 at 20:38
-
I got your point.Makes complete sense. Is that the end of the road. Isn't there any way around this, like any way to integrate with the git terminal. – Asif Kamran Malick May 08 '19 at 20:44
-
Thank you @RayToal I think I should rephrase my question. – Asif Kamran Malick May 08 '19 at 21:00
-
Note that *Git* itself provides no REST API for *anything;* all web-server things are add-ons. You're looking specifically at *GitHub* here, which is not something included in a Git distribution (GitHub's add-ons are proprietary). – torek May 08 '19 at 22:41
1 Answers
2
Server repositories are bare, they don't have the working directory. And in a bare repository (even local) git status
is meaningless (because it compares the repository with the working tree) and produces error:
fatal: This operation must be run in a work tree
Hence there is no API for getting status.

phd
- 82,685
- 13
- 120
- 165
-
I had just rephrased my question.Thank you for clarifying it – Asif Kamran Malick May 08 '19 at 21:15
-
It's a completely different question now. IMO it would be better if you restore the original question and ask a different question separately. Or my answer looks stupid and irrelevant. – phd May 08 '19 at 21:45
-
1rolled back. but I guess people would have still been able to go through the original question , thanks to stackoverflow's history feature. – Asif Kamran Malick May 08 '19 at 21:52