forked from github/developer.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
248 lines (228 loc) · 11.5 KB
/
Copy pathindex.html
File metadata and controls
248 lines (228 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="imagetoolbar" content="false" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<title>Git | GitHub API</title>
<link rel="alternate" type="application/atom+xml" title="API Changes" href="/changes.atom" />
<link href="/css/reset.css" rel="stylesheet" type="text/css" />
<link href="/css/960.css" rel="stylesheet" type="text/css" />
<link href="/css/uv_active4d.css" rel="stylesheet" type="text/css" />
<link href="/shared/css/documentation.css" media="screen" rel="stylesheet" type="text/css">
<link href="/shared/css/pygments.css" media="screen" rel="stylesheet" type="text/css">
<script src="/shared/js/jquery.js" type="text/javascript"></script>
<script src="/shared/js/documentation.js" type="text/javascript"></script>
</head>
<body class="api">
<div id="header-wrapper">
<div id="header">
<div>
<a class="logo" href="/"><img src="/images/logo_developer.png" width="255" height="45" alt="GitHub:Developer" /></a>
<ul class="nav">
<li><a href="/v3/">API v3</a></li>
<li><a href="/changes/">Changes</a></li>
<li><a
href="https://github.com/contact">Support</a></li>
<li><a href="/changes.atom">
<img src="/images/feed-icon-28x28.png" width="16" height="16" alt="GitHub API Changes Feed" />
</a></li>
</ul>
</div>
</div><!-- #header -->
</div><!-- #header-wrapper -->
<div id="wrapper">
<div class="content">
<h1 id="git-db-api">Git DB API</h1>
<p>The Git Database API gives you access to read and write raw Git objects
to your Git database on GitHub and to list and update your references
(branch heads and tags).</p>
<p>This basically allows you to reimplement a lot of Git functionality over
our API - by creating raw objects directly into the database and updating
branch references you could technically do just about anything that Git
can do without having Git installed.</p>
<p>Git DB API functions will return a 409 if the git repo for a Repository is empty
or unavailable. This typically means it is being created still. <a href="https://github.com/contact">Contact
Support</a> if this response status persists.</p>
<p><img src="http://git-scm.com/figures/18333fig0904-tn.png" alt="git db"></p>
<p>For more information on the Git object database, please read the
<a href="http://git-scm.com/book/en/Git-Internals">Git Internals</a> chapter of
the Pro Git book.</p>
<p>As an example, if you wanted to commit a change to a file in your
repository, you would:</p>
<ul>
<li>get the current commit object</li>
<li>retrieve the tree it points to</li>
<li>retrieve the content of the blob object that tree has for that particular file path</li>
<li>change the content somehow and post a new blob object with that new content, getting a blob SHA back</li>
<li>post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back</li>
<li>create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back</li>
<li>update the reference of your branch to point to the new commit SHA</li>
</ul><p>It might seem complex, but it’s actually pretty simple when you understand
the model and it opens up a ton of things you could potentially do with the API.</p>
</div>
<div id="js-sidebar" class="sidebar-shell">
<div class="js-toggle-list sidebar-module expandable">
<ul>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/">Summary</a></h3>
<ul class="js-guides">
<li><a href="/v3/oauth/">OAuth</a></li>
<li><a href="/v3/media/">Media Types</a></li>
<li><a href="/v3/libraries/">Libraries</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/gists/">Gists</a></h3>
<ul class="js-guides">
<li><a href="/v3/gists/comments/">Comments</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/git/">Git Data</a></h3>
<ul class="js-guides">
<li><a href="/v3/git/blobs/">Blobs</a></li>
<li><a href="/v3/git/commits/">Commits</a></li>
<li><a href="/v3/git/refs/">References</a></li>
<li><a href="/v3/git/tags/">Tags</a></li>
<li><a href="/v3/git/trees/">Trees</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/issues/">Issues</a></h3>
<ul class="js-guides">
<li><a href="/v3/issues/assignees/">Assignees</a></li>
<li><a href="/v3/issues/comments/">Comments</a></li>
<li><a href="/v3/issues/events/">Events</a></li>
<li><a href="/v3/issues/labels/">Labels</a></li>
<li><a href="/v3/issues/milestones/">Milestones</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/orgs/">Orgs</a></h3>
<ul class="js-guides">
<li><a href="/v3/orgs/members/">Members</a></li>
<li><a href="/v3/orgs/teams/">Teams</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/pulls/">Pull Requests</a></h3>
<ul class="js-guides">
<li><a href="/v3/pulls/comments/">Review Comments</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/repos/">Repositories</a></h3>
<ul class="js-guides">
<li><a href="/v3/repos/collaborators/">Collaborators</a></li>
<li><a href="/v3/repos/comments/">Comments</a></li>
<li><a href="/v3/repos/commits/">Commits</a></li>
<li><a href="/v3/repos/contents/">Contents</a></li>
<li><a href="/v3/repos/downloads/">Downloads</a></li>
<li><a href="/v3/repos/forks/">Forks</a></li>
<li><a href="/v3/repos/keys/">Keys</a></li>
<li><a href="/v3/repos/hooks/">Hooks</a></li>
<li><a href="/v3/repos/merging/">Merging</a></li>
<li><a href="/v3/repos/starring/">Starring</a></li>
<li><a href="/v3/repos/statuses/">Statuses</a></li>
<li><a href="/v3/repos/watching/">Watching</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/users/">Users</a></h3>
<ul class="js-guides">
<li><a href="/v3/users/emails/">Emails</a></li>
<li><a href="/v3/users/followers/">Followers</a></li>
<li><a href="/v3/users/keys/">Keys</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/events/">Events</a></h3>
<ul class="js-guides">
<li><a href="/v3/events/types/">Types</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed"> </a><a href="/v3/search/">Search</a></h3>
<ul class="js-guides">
<li><a href="/v3/search/#search-issues">Issues</a></li>
<li><a href="/v3/search/#search-repositories">Repositories</a></li>
<li><a href="/v3/search/#search-users">Users</a></li>
<li><a href="/v3/search/#email-search">Email</a></li>
</ul>
</li>
<li class="js-guides"><h3><a href="/v3/markdown/">Markdown</a></h3></li>
</ul>
</div> <!-- /sidebar-module -->
<div class="sidebar-module">
<p>This website is a <a href="https://github.com/github/developer.github.com" target="_blank">public GitHub repository</a>. Please help us by forking the project and adding to it.</p>
</div>
</div><!-- /sidebar-shell -->
</div><!-- #wrapper -->
<div id="footer" >
<div class="upper_footer">
<div class="footer_inner clearfix">
<!--[if IE]><h4 id="blacktocat_ie">GitHub Links</h4><![endif]-->
<![if !IE]><h4 id="blacktocat">GitHub Links</h4><![endif]>
<ul class="footer_nav">
<h4>GitHub</h4>
<li><a href="https://github.com/about">About</a></li>
<li><a href="https://github.com/blog">Blog</a></li>
<li><a href="https://github.com/features">Features</a></li>
<li><a href="https://github.com/contact">Contact & Support</a></li>
<li><a href="https://github.com/training">Training</a></li>
<li><a href="http://status.github.com/">Site Status</a></li>
</ul>
<ul class="footer_nav">
<h4>Tools</h4>
<li><a href="http://mac.github.com/">GitHub for Mac</a></li>
<li><a href="http://mobile.github.com/">Issues for iPhone</a></li>
<li><a href="https://gist.github.com">Gist: Code Snippets</a></li>
<li><a href="http://enterprise.github.com/">GitHub Enterprise</a></li>
<li><a href="http://jobs.github.com/">Job Board</a></li>
</ul>
<ul class="footer_nav">
<h4>Extras</h4>
<li><a href="http://shop.github.com/">GitHub Shop</a></li>
<li><a href="http://octodex.github.com/">The Octodex</a></li>
</ul>
<ul class="footer_nav">
<h4>Documentation</h4>
<li><a href="http://help.github.com/">GitHub Help</a></li>
<li><a href="http://developer.github.com/">Developer API</a></li>
<li><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></li>
<li><a href="http://pages.github.com/">GitHub Pages</a></li>
</ul>
</div><!-- /.site -->
</div><!-- /.upper_footer -->
<div class="lower_footer">
<div class="footer_inner clearfix">
<div id="legal">
<!--[if IE]><a class="home_ie" href="http://github.com">Home</a><![endif]-->
<![if !IE]><a class="home" href="http://github.com">Home</a><![endif]>
<ul id="legal_links">
<li><a href="http://help.github.com/terms-of-service/">Terms of Service</a></li>
<li><a href="http://help.github.com/privacy-policy/">Privacy</a></li>
<li><a href="http://help.github.com/security/">Security</a></li>
</ul>
<p>© <span id="year">year</span> GitHub Inc. All rights reserved.</p>
</div><!-- /#legal or /#legal_ie-->
</div><!-- /.site -->
</div><!-- /.lower_footer -->
</div><!-- /#footer -->
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '4f2038e0cb25bc1b55000003');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
</body>
</html>