跳到主要内容

Commit Event

Description of Commit event parameters

Request Headers

Parameter NameTypeDescription
User-Agentstring
Content-Typestring
X-GitCode-EventstringEvent type, Push Hook represents the push event
X-GitCode-DeliverystringUnique request ID

Request Parameters

Parameter NameParameter TypeDescription
object_kindstringEvent type, here "push" indicates a push event
event_namestringEvent name, same as object_kind, indicating a push event
beforestringThe commit SHA value before the push
afterstringThe commit SHA value after the push
refstringGit reference path, e.g., "refs/heads/main" for the main branch
checkout_shastringThe checked-out commit SHA value
messagestringMessage content
user_idintegerUser ID triggering the push event
user_namestringUser's display name
user_usernamestringUser's username
user_emailstringUser's email address
user_avatarstringUser's avatar URL address
project_idintegerProject's unique identifier
project.idintegerProject ID
project.namestringProject name
project.descriptionstringProject description
project.web_urlstringProject's web access URL
project.avatar_urlstringProject's avatar URL address
project.git_ssh_urlstringProject's SSH clone URL
project.git_http_urlstringProject's HTTP clone URL
project.namespacestringProject's namespace
project.visibility_levelintegerProject visibility level (0: private, 1: public)
project.path_with_namespacestringProject path with namespace
project.default_branchstringProject's default branch
project.homepagestringProject homepage URL
project.urlstringProject Git repository URL
project.ssh_urlstringProject SSH clone URL
project.http_urlstringProject HTTP clone URL
commits[].idstringCommit SHA value
commits[].messagestringCommit message
commits[].timestampstringCommit timestamp
commits[].urlstringURL for the commit details page
commits[].author.namestringCommit author's name
commits[].author.emailstringCommit author's email
commits[].addedarrayList of files added in this commit
commits[].removedarrayList of files removed in this commit
commits[].modifiedarrayList of files modified in this commit
total_commits_countintegerTotal number of commits pushed
push_optionsarrayArray of push options
repository.namestringRepository name
repository.urlstringRepository Git URL
repository.descriptionstringRepository description
repository.homepagestringRepository homepage URL
repository.git_http_urlstringRepository HTTP clone address
repository.git_ssh_urlstringRepository SSH clone address
repository.visibility_levelintegerRepository visibility level (0: private, 1: public)
git_branchstringTarget branch name for the push
git_commit_nostringSHA value of the latest commit
manual_buildboolean
uuidstringUnique identifier for this push event

Example of Request Parameters

{
"object_kind": "push",
"event_name": "push",
"before": "1d27e394fbd0491f139dd2e577aa3e214a2fc18e",
"after": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"ref": "refs/heads/main",
"checkout_sha": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"message": "",
"user_id": 173794,
"user_name": "xiaogang_o",
"user_username": "xiaogang_o",
"user_email": "",
"user_avatar": "https://cdn-img.gitcode.com/ee/ca/756863eec250a6a067148d4d4fe71d28c3b9716a6f79c03a9f460543fa3dc838.jpg?time=1711433667506",
"project_id": 1848674,
"project": {
"id": 1848674,
"name": "test",
"web_url": "https://gitcode.com/xiaogang_o/test",
"avatar_url": "https://cdn-img.gitcode.com/ee/ca/756863eec250a6a067148d4d4fe71d28c3b9716a6f79c03a9f460543fa3dc838.jpg?time=1711433667506",
"git_ssh_url": "git@gitcode.com:xiaogang_o/test.git",
"git_http_url": "https://gitcode.com/xiaogang_o/test.git",
"namespace": "xiaogang_o",
"visibility_level": 0,
"path_with_namespace": "xiaogang_o/test",
"default_branch": "main",
"homepage": "https://gitcode.com/xiaogang_o/test",
"url": "git@gitcode.com:xiaogang_o/test.git",
"ssh_url": "git@gitcode.com:xiaogang_o/test.git",
"http_url": "https://gitcode.com/xiaogang_o/test.git"
},
"commits": [
{
"id": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"message": "update: 更新文件 你好.txtSigned-off-by: xiaogang_o <xiaogang@csdn.net>",
"timestamp": "2025-05-07T05:58:22Z",
"url": "https://gitcode.com/xiaogang_o/test/commits/detail/d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"author": {
"name": "xiaogang_o",
"email": "xiaogang@csdn.net"
},
"added": [],
"removed": [],
"modified": [
"你好.txt"
]
}
],
"total_commits_count": 1,
"push_options": [],
"repository": {
"name": "test",
"url": "git@gitcode.com:xiaogang_o/test.git",
"homepage": "https://gitcode.com/xiaogang_o/test",
"git_http_url": "https://gitcode.com/xiaogang_o/test.git",
"git_ssh_url": "git@gitcode.com:xiaogang_o/test.git",
"visibility_level": 0
},
"git_branch": "main",
"git_commit_no": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"manual_build": false,
"uuid": "d6869f2d-56a3-4b77-90ee-f4957e582df6"
}