gpt4 book ai didi

How to obtain information about the IP address of the user who made commit to the github repository(如何获取有关提交到GitHub存储库的用户的IP地址的信息)

翻译 作者:bug小助手 更新时间:2023-10-26 22:30:44 25 4
gpt4 key购买 nike



It it possible to obtain the IP address of the user who made a commit in the github repo?


I'm trying the commits API call, but it doesn't contain any information about that.

我正在尝试提交API调用,但它不包含任何有关这方面的信息。


curl --request GET --url "https://api.github.com/repos/org/test-public-repo/commits/b46fffeeac69892470eea14692c218ea7a09ac10" \
--header "Authorization: Bearer $TOKEN" \
--header "X-GitHub-Api-Version: 2022-11-28"

output


{
"sha": "b46fffeeac69892470eea14692c218ea7a09ac10",
"node_id": "C_kwDOKRgIVtoAKGI0NmZmZmVlYWM2OTg5MjQ3MGVlYTE0NjkyYzIxOGVhN2EwOWFjMTA",
"commit": {
"author": {
"name": "FName LName",
"email": "[email protected]",
"date": "2023-09-09T21:05:38Z"
},
"committer": {
"name": "FName LName",
"email": "[email protected]",
"date": "2023-09-09T21:05:38Z"
},
"message": "feat: test ip",
"tree": {
"sha": "912b9f298c81c371c7da2070bc860964d124cfeb",
"url": "https://api.github.com/repos/org/test-public-repo/git/trees/912b9f298c81c371c7da2070bc860964d124cfeb"
},
"url": "https://api.github.com/repos/org/test-public-repo/git/commits/b46fffeeac69892470eea14692c218ea7a09ac10",
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"url": "https://api.github.com/repos/org/test-public-repo/commits/b46fffeeac69892470eea14692c218ea7a09ac10",
"html_url": "https://github.com/org/test-public-repo/commit/b46fffeeac69892470eea14692c218ea7a09ac10",
"comments_url": "https://api.github.com/repos/org/test-public-repo/commits/b46fffeeac69892470eea14692c218ea7a09ac10/comments",
"author": {
"login": "github-user",
"id": 11111,
"node_id": "MDQ6VXNlcjcwODIyNzEw",
"avatar_url": "https://avatars.githubusercontent.com/u/70822710?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-user",
"html_url": "https://github.com/github-user",
"followers_url": "https://api.github.com/users/github-user/followers",
"following_url": "https://api.github.com/users/github-user/following{/other_user}",
"gists_url": "https://api.github.com/users/github-user/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-user/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-user/subscriptions",
"organizations_url": "https://api.github.com/users/github-user/orgs",
"repos_url": "https://api.github.com/users/github-user/repos",
"events_url": "https://api.github.com/users/github-user/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-user/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "github-user",
"id": 11111,
"node_id": "MDQ6VXNlcjcwODIyNzEw",
"avatar_url": "https://avatars.githubusercontent.com/u/11111?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-user",
"html_url": "https://github.com/github-user",
"followers_url": "https://api.github.com/users/github-user/followers",
"following_url": "https://api.github.com/users/github-user/following{/other_user}",
"gists_url": "https://api.github.com/users/github-user/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-user/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-user/subscriptions",
"organizations_url": "https://api.github.com/users/github-user/orgs",
"repos_url": "https://api.github.com/users/github-user/repos",
"events_url": "https://api.github.com/users/github-user/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-user/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"sha": "26c26f8856cd81d9f9144e6654897320f4b9f575",
"url": "https://api.github.com/repos/org/test-public-repo/commits/26c26f8856cd81d9f9144e6654897320f4b9f575",
"html_url": "https://github.com/org/test-public-repo/commit/26c26f8856cd81d9f9144e6654897320f4b9f575"
}
],
"stats": {
"total": 1,
"additions": 1,
"deletions": 0
},
"files": [
{
"sha": "e389600420ded46e657d418951fa716c9f18bb12",
"filename": "README.md",
"status": "modified",
"additions": 1,
"deletions": 0,
"changes": 1,
"blob_url": "https://github.com/org/test-public-repo/blob/b46fffeeac69892470eea14692c218ea7a09ac10/README.md",
"raw_url": "https://github.com/org/test-public-repo/raw/b46fffeeac69892470eea14692c218ea7a09ac10/README.md",
"contents_url": "https://api.github.com/repos/org/test-public-repo/contents/README.md?ref=b46fffeeac69892470eea14692c218ea7a09ac10",
"patch": "@@ -2,3 +2,4 @@\n test\n \n ii\n+aa"
}
]
}


更多回答
优秀答案推荐

I don't believe that's possible. First of all, GitHub doesn't know the IP address of the person who created the commit, only the person who pushed it, which may not be the same. In addition, a person can have many IP addresses (home, work, school, coffee shop) and GitHub could only know the IP address that the person who pushed it was using at the given time.

我不相信这是可能的。首先,GitHub不知道创建提交的人的IP地址,只知道推送它的人的IP地址,这可能不同。此外,一个人可以有多个IP地址(家庭、办公室、学校、咖啡店),而GitHub只能知道推送者在给定时间使用的IP地址。


Also, in general, exposing that would be problematic from a personal data standpoint, since people don't have to use a real name or a real email address to commit on GitHub, and many people would be uncomfortable exposing their home or work IP. Think of situations where people have engaged in harassment or swatting against others for various reasons, or users in countries with repressive governments. It might also violate various privacy laws, such as GDPR, to reveal that information without the user's consent.

此外,总的来说,从个人数据的角度来看,曝光这一点是有问题的,因为人们不必使用真实姓名或真实的电子邮件地址来在GitHub上提交承诺,而且许多人会对曝光他们的家庭或工作IP感到不舒服。想想人们出于各种原因对他人进行骚扰或殴打的情况,或者是在政府专制的国家里的用户。在未经用户同意的情况下泄露这些信息也可能违反各种隐私法,如GDPR。


更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com