Repository navigation
Expand file tree
/
Copy pathgit.yaml
More file actions
1626 lines (1592 loc) · 63.8 KB
/
Copy pathgit.yaml
File metadata and controls
1626 lines (1592 loc) · 63.8 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: git API
description: Raw Git functionality.
version: 1.1.4
paths:
/repos/{owner}/{repo}/git/blobs:
post:
summary: Create a blob
description: ''
tags:
- git
operationId: git/create-blob
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/blobs#create-a-blob
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
content:
type: string
description: The new blob's content.
encoding:
type: string
description: The encoding used for `content`. Currently, `"utf-8"` and `"base64"` are supported.
default: utf-8
required:
- content
examples:
default:
value:
content: Content of the blob
encoding: utf-8
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/short-blob'
examples:
default:
$ref: '#/components/examples/short-blob'
headers:
Location:
example: https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15
schema:
type: string
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
'422':
description: Validation failed
content:
application/json:
schema:
title: Validation Error
description: Validation Error
type: object
required:
- message
- documentation_url
properties:
message:
type: string
documentation_url:
type: string
errors:
type: array
items:
type: object
required:
- code
properties:
resource:
type: string
field:
type: string
message:
type: string
code:
type: string
index:
type: integer
value:
oneOf:
- type: string
nullable: true
- type: integer
nullable: true
- type: array
nullable: true
items:
type: string
status:
type: string
metadata:
type: object
properties:
secret_scanning:
type: object
properties:
bypass_placeholders:
type: array
items:
type: object
properties:
placeholder_id:
$ref: '#/components/schemas/secret-scanning-push-protection-bypass-placeholder-id'
token_type:
type: string
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: blobs
x-stackQL-resource: blobs
/repos/{owner}/{repo}/git/blobs/{file_sha}:
get:
summary: Get a blob
description: |-
The `content` in the response will always be Base64 encoded.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/vnd.github.raw+json`**: Returns the raw blob data.
- **`application/vnd.github+json`**: Returns a JSON representation of the blob with `content` as a base64 encoded string. This is the default if no media type is specified.
**Note** This endpoint supports blobs up to 100 megabytes in size.
tags:
- git
operationId: git/get-blob
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/blobs#get-a-blob
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- name: file_sha
in: path
required: true
schema:
type: string
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/blob'
examples:
default:
$ref: '#/components/examples/blob'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: blobs
x-stackQL-resource: blobs
/repos/{owner}/{repo}/git/commits:
post:
summary: Create a commit
description: |-
Creates a new Git [commit object](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects).
**Signature verification object**
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
| Name | Type | Description |
| ---- | ---- | ----------- |
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in the table below. |
| `signature` | `string` | The signature that was extracted from the commit. |
| `payload` | `string` | The value that was signed. |
| `verified_at` | `string` | The date the signature was verified by GitHub. |
These are the possible values for `reason` in the `verification` object:
| Value | Description |
| ----- | ----------- |
| `expired_key` | The key that made the signature is expired. |
| `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
| `gpgverify_error` | There was an error communicating with the signature verification service. |
| `gpgverify_unavailable` | The signature verification service is currently unavailable. |
| `unsigned` | The object does not include a signature. |
| `unknown_signature_type` | A non-PGP signature was found in the commit. |
| `no_user` | No user was associated with the `committer` email address in the commit. |
| `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. |
| `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. |
| `unknown_key` | The key that made the signature has not been registered with any user's account. |
| `malformed_signature` | There was an error parsing the signature. |
| `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
| `valid` | None of the above errors applied, so the signature is considered to be verified. |
tags:
- git
operationId: git/create-commit
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/commits#create-a-commit
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: The commit message
tree:
type: string
description: The SHA of the tree object this commit points to
parents:
type: array
description: The full SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided.
items:
type: string
author:
type: object
description: Information about the author of the commit. By default, the `author` will be the authenticated user and the current date. See the `author` and `committer` object below for details.
properties:
name:
type: string
description: The name of the author (or committer) of the commit
email:
type: string
description: The email of the author (or committer) of the commit
date:
type: string
format: date-time
description: 'Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.'
required:
- name
- email
committer:
type: object
description: Information about the person who is making the commit. By default, `committer` will use the information set in `author`. See the `author` and `committer` object below for details.
properties:
name:
type: string
description: The name of the author (or committer) of the commit
email:
type: string
description: The email of the author (or committer) of the commit
date:
type: string
format: date-time
description: 'Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.'
signature:
type: string
description: The [PGP signature](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) of the commit. GitHub adds the signature to the `gpgsig` header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a `signature` parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to [use the command line](https://git-scm.com/book/id/v2/Git-Tools-Signing-Your-Work) to create signed commits.
required:
- message
- tree
examples:
default:
value:
message: my commit message
author:
name: Mona Octocat
email: octocat@github.com
date: '2008-07-09T16:13:30+12:00'
parents:
- 7d1b31e74ee336d15cbd21741bc88a537ed063a0
tree: 827efc6d56897b048c772eb4087f854f46256132
signature: |
-----BEGIN PGP SIGNATURE-----
iQIzBAABAQAdFiEESn/54jMNIrGSE6Tp6cQjvhfv7nAFAlnT71cACgkQ6cQjvhfv
7nCWwA//XVqBKWO0zF+bZl6pggvky3Oc2j1pNFuRWZ29LXpNuD5WUGXGG209B0hI
DkmcGk19ZKUTnEUJV2Xd0R7AW01S/YSub7OYcgBkI7qUE13FVHN5ln1KvH2all2n
2+JCV1HcJLEoTjqIFZSSu/sMdhkLQ9/NsmMAzpf/iIM0nQOyU4YRex9eD1bYj6nA
OQPIDdAuaTQj1gFPHYLzM4zJnCqGdRlg0sOM/zC5apBNzIwlgREatOYQSCfCKV7k
nrU34X8b9BzQaUx48Qa+Dmfn5KQ8dl27RNeWAqlkuWyv3pUauH9UeYW+KyuJeMkU
+NyHgAsWFaCFl23kCHThbLStMZOYEnGagrd0hnm1TPS4GJkV4wfYMwnI4KuSlHKB
jHl3Js9vNzEUQipQJbgCgTiWvRJoK3ENwBTMVkKHaqT4x9U4Jk/XZB6Q8MA09ezJ
3QgiTjTAGcum9E9QiJqMYdWQPWkaBIRRz5cET6HPB48YNXAAUsfmuYsGrnVLYbG+
UpC6I97VybYHTy2O9XSGoaLeMI9CsFn38ycAxxbWagk5mhclNTP5mezIq6wKSwmr
X11FW3n1J23fWZn5HJMBsRnUCgzqzX3871IqLYHqRJ/bpZ4h20RhTyPj5c/z7QXp
eSakNQMfbbMcljkha+ZMuVQX1K9aRlVqbmv3ZMWh+OijLYVU2bc=
=5Io4
-----END PGP SIGNATURE-----
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-commit'
examples:
default:
$ref: '#/components/examples/git-commit'
headers:
Location:
example: https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd
schema:
type: string
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: commits
x-stackQL-resource: commits
/repos/{owner}/{repo}/git/commits/{commit_sha}:
get:
summary: Get a commit object
description: |-
Gets a Git [commit object](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects).
To get the contents of a commit, see "[Get a commit](/rest/commits/commits#get-a-commit)."
**Signature verification object**
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
| Name | Type | Description |
| ---- | ---- | ----------- |
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in the table below. |
| `signature` | `string` | The signature that was extracted from the commit. |
| `payload` | `string` | The value that was signed. |
| `verified_at` | `string` | The date the signature was verified by GitHub. |
These are the possible values for `reason` in the `verification` object:
| Value | Description |
| ----- | ----------- |
| `expired_key` | The key that made the signature is expired. |
| `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
| `gpgverify_error` | There was an error communicating with the signature verification service. |
| `gpgverify_unavailable` | The signature verification service is currently unavailable. |
| `unsigned` | The object does not include a signature. |
| `unknown_signature_type` | A non-PGP signature was found in the commit. |
| `no_user` | No user was associated with the `committer` email address in the commit. |
| `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. |
| `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. |
| `unknown_key` | The key that made the signature has not been registered with any user's account. |
| `malformed_signature` | There was an error parsing the signature. |
| `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
| `valid` | None of the above errors applied, so the signature is considered to be verified. |
tags:
- git
operationId: git/get-commit
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/commits#get-a-commit-object
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/commit-sha'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-commit'
examples:
default:
$ref: '#/components/examples/git-commit-2'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: commits
x-stackQL-resource: commits
/repos/{owner}/{repo}/git/matching-refs/{ref}:
get:
summary: List matching references
description: |-
Returns an array of references from your Git database that match the supplied name. The `:ref` in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags. If the `:ref` doesn't exist in the repository, but existing refs start with `:ref`, they will be returned as an array.
When you use this endpoint without providing a `:ref`, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just `heads` and `tags`.
> [!NOTE]
> You need to explicitly [request a pull request](https://docs.github.com/rest/pulls/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)".
If you request matching references for a branch named `feature` but the branch `feature` doesn't exist, the response can still include other matching head refs that start with the word `feature`, such as `featureA` and `featureB`.
tags:
- git
operationId: git/list-matching-refs
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/refs#list-matching-references
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/git-ref-only'
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/git-ref'
examples:
default:
$ref: '#/components/examples/git-ref-items'
headers:
Link:
$ref: '#/components/headers/link'
'409':
$ref: '#/components/responses/conflict'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: refs
x-stackQL-resource: refs
/repos/{owner}/{repo}/git/ref/{ref}:
get:
summary: Get a reference
description: |-
Returns a single reference from your Git database. The `:ref` in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags. If the `:ref` doesn't match an existing ref, a `404` is returned.
> [!NOTE]
> You need to explicitly [request a pull request](https://docs.github.com/rest/pulls/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)".
tags:
- git
operationId: git/get-ref
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/refs#get-a-reference
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/git-ref-only'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-ref'
examples:
default:
$ref: '#/components/examples/git-ref'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: refs
x-stackQL-resource: refs
/repos/{owner}/{repo}/git/refs:
post:
summary: Create a reference
description: 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.
tags:
- git
operationId: git/create-ref
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/refs#create-a-reference
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
ref:
type: string
description: 'The 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:
type: string
description: The SHA1 value for this reference.
required:
- ref
- sha
examples:
default:
value:
ref: refs/heads/featureA
sha: aa218f56b14c9653891f9e74264a383fa43fefbd
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-ref'
examples:
default:
$ref: '#/components/examples/git-ref'
headers:
Location:
example: https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA
schema:
type: string
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: refs
x-stackQL-resource: refs
/repos/{owner}/{repo}/git/refs/{ref}:
patch:
summary: Update a reference
description: Updates the provided reference to point to a new SHA. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation.
tags:
- git
operationId: git/update-ref
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/refs#update-a-reference
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/git-ref-only'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
sha:
type: string
description: The SHA1 value to set this reference to
force:
type: boolean
description: Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work.
default: false
required:
- sha
examples:
default:
value:
sha: aa218f56b14c9653891f9e74264a383fa43fefbd
force: true
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-ref'
examples:
default:
$ref: '#/components/examples/git-ref'
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: refs
x-stackQL-resource: refs
delete:
summary: Delete a reference
description: Deletes the provided reference.
tags:
- git
operationId: git/delete-ref
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/refs#delete-a-reference
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/git-ref-only'
responses:
'204':
description: Response
'409':
$ref: '#/components/responses/conflict'
'422':
description: Validation failed, an attempt was made to delete the default branch, or the endpoint has been spammed.
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: refs
x-stackQL-resource: refs
/repos/{owner}/{repo}/git/tags:
post:
summary: Create a tag object
description: |-
Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then [create](https://docs.github.com/rest/git/refs#create-a-reference) the `refs/tags/[tag]` reference. If you want to create a lightweight tag, you only have to [create](https://docs.github.com/rest/git/refs#create-a-reference) the tag reference - this call would be unnecessary.
**Signature verification object**
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
| Name | Type | Description |
| ---- | ---- | ----------- |
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. |
| `signature` | `string` | The signature that was extracted from the commit. |
| `payload` | `string` | The value that was signed. |
| `verified_at` | `string` | The date the signature was verified by GitHub. |
These are the possible values for `reason` in the `verification` object:
| Value | Description |
| ----- | ----------- |
| `expired_key` | The key that made the signature is expired. |
| `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
| `gpgverify_error` | There was an error communicating with the signature verification service. |
| `gpgverify_unavailable` | The signature verification service is currently unavailable. |
| `unsigned` | The object does not include a signature. |
| `unknown_signature_type` | A non-PGP signature was found in the commit. |
| `no_user` | No user was associated with the `committer` email address in the commit. |
| `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. |
| `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. |
| `unknown_key` | The key that made the signature has not been registered with any user's account. |
| `malformed_signature` | There was an error parsing the signature. |
| `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
| `valid` | None of the above errors applied, so the signature is considered to be verified. |
tags:
- git
operationId: git/create-tag
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/tags#create-a-tag-object
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
tag:
type: string
description: The tag's name. This is typically a version (e.g., "v0.0.1").
message:
type: string
description: The tag message.
object:
type: string
description: The SHA of the git object this is tagging.
type:
type: string
description: The type of the object we're tagging. Normally this is a `commit` but it can also be a `tree` or a `blob`.
enum:
- commit
- tree
- blob
tagger:
type: object
description: An object with information about the individual creating the tag.
properties:
name:
type: string
description: The name of the author of the tag
email:
type: string
description: The email of the author of the tag
date:
type: string
format: date-time
description: 'When this object was tagged. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.'
required:
- name
- email
required:
- tag
- message
- object
- type
examples:
default:
value:
tag: v0.0.1
message: initial version
object: c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c
type: commit
tagger:
name: Monalisa Octocat
email: octocat@github.com
date: '2011-06-17T14:53:35-07:00'
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-tag'
examples:
default:
$ref: '#/components/examples/git-tag'
headers:
Location:
example: https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac
schema:
type: string
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: tags
x-stackQL-resource: tags
/repos/{owner}/{repo}/git/tags/{tag_sha}:
get:
summary: Get a tag
description: |-
**Signature verification object**
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
| Name | Type | Description |
| ---- | ---- | ----------- |
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. |
| `signature` | `string` | The signature that was extracted from the commit. |
| `payload` | `string` | The value that was signed. |
| `verified_at` | `string` | The date the signature was verified by GitHub. |
These are the possible values for `reason` in the `verification` object:
| Value | Description |
| ----- | ----------- |
| `expired_key` | The key that made the signature is expired. |
| `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
| `gpgverify_error` | There was an error communicating with the signature verification service. |
| `gpgverify_unavailable` | The signature verification service is currently unavailable. |
| `unsigned` | The object does not include a signature. |
| `unknown_signature_type` | A non-PGP signature was found in the commit. |
| `no_user` | No user was associated with the `committer` email address in the commit. |
| `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. |
| `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. |
| `unknown_key` | The key that made the signature has not been registered with any user's account. |
| `malformed_signature` | There was an error parsing the signature. |
| `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
| `valid` | None of the above errors applied, so the signature is considered to be verified. |
tags:
- git
operationId: git/get-tag
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/tags#get-a-tag
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- name: tag_sha
in: path
required: true
schema:
type: string
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-tag'
examples:
default:
$ref: '#/components/examples/git-tag'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: tags
x-stackQL-resource: tags
/repos/{owner}/{repo}/git/trees:
post:
summary: Create a tree
description: |-
The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.
If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "[Create a commit](https://docs.github.com/rest/git/commits#create-a-commit)" and "[Update a reference](https://docs.github.com/rest/git/refs#update-a-reference)."
Returns an error if you try to delete a file that does not exist.
tags:
- git
operationId: git/create-tree
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/trees#create-a-tree
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
tree:
type: array
description: Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure.
items:
type: object
properties:
path:
type: string
description: The file referenced in the tree.
mode:
type: string
description: The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink.
enum:
- '100644'
- '100755'
- '040000'
- '160000'
- '120000'
type:
type: string
description: Either `blob`, `tree`, or `commit`.
enum:
- blob
- tree
- commit
sha:
type: string
description: |-
The SHA1 checksum ID of the object in the tree. Also called `tree.sha`. If the value is `null` then the file will be deleted.
**Note:** Use either `tree.sha` or `content` to specify the contents of the entry. Using both `tree.sha` and `content` will return an error.
nullable: true
content:
type: string
description: |-
The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or `tree.sha`.
**Note:** Use either `tree.sha` or `content` to specify the contents of the entry. Using both `tree.sha` and `content` will return an error.
base_tree:
type: string
description: |-
The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by `base_tree` and entries defined in the `tree` parameter. Entries defined in the `tree` parameter will overwrite items from `base_tree` with the same `path`. If you're creating new changes on a branch, then normally you'd set `base_tree` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on.
If not provided, GitHub will create a new Git tree object from only the entries defined in the `tree` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the `tree` parameter will be listed as deleted by the new commit.
required:
- tree
examples:
default:
value:
base_tree: 9fb037999f264ba9a7fc6274d15fa3ae2ab98312
tree:
- path: file.rb
mode: '100644'
type: blob
sha: 44b4fc6d56897b048c772eb4087f854f46256132
responses:
'201':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-tree'
examples:
default:
$ref: '#/components/examples/git-tree'
headers:
Location:
example: https://api.github.com/repos/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7
schema:
type: string
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: trees
x-stackQL-resource: trees
/repos/{owner}/{repo}/git/trees/{tree_sha}:
get:
summary: Get a tree
description: |-
Returns a single tree using the SHA1 value or ref name for that tree.
If `truncated` is `true` in the response then the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time.
> [!NOTE]
> The limit for the `tree` array is 100,000 entries with a maximum size of 7 MB when using the `recursive` parameter.
tags:
- git
operationId: git/get-tree
externalDocs:
description: API method documentation
url: https://docs.github.com/rest/git/trees#get-a-tree
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- name: tree_sha
description: The SHA1 value or ref (branch or tag) name of the tree.
in: path
required: true
schema:
type: string
x-multi-segment: true
- name: recursive
description: 'Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in `:tree_sha`. For example, setting `recursive` to any of the following will enable returning objects or subtrees: `0`, `1`, `"true"`, and `"false"`. Omit this parameter to prevent recursively returning objects or subtrees.'
in: query
required: false
schema:
type: string
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/git-tree'
examples:
default-response:
$ref: '#/components/examples/git-tree-default-response'
response-recursively-retrieving-a-tree:
$ref: '#/components/examples/git-tree-response-recursively-retrieving-a-tree'
'404':
$ref: '#/components/responses/not_found'
'409':
$ref: '#/components/responses/conflict'
'422':
$ref: '#/components/responses/validation_failed'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: git
subcategory: trees
x-stackQL-resource: trees
components:
schemas:
short-blob:
title: Short Blob
description: Short Blob
type: object
properties:
url:
type: string
sha:
type: string
required:
- url
- sha
validation-error:
title: Validation Error
description: Validation Error
type: object
required:
- message
- documentation_url
properties:
message: