Skip to content

Instantly share code, notes, and snippets.

@tbvinh
Created January 29, 2026 06:54
Show Gist options
  • Select an option

  • Save tbvinh/c957e056f91680cc0e9d85ef41dc2ae4 to your computer and use it in GitHub Desktop.

Select an option

Save tbvinh/c957e056f91680cc0e9d85ef41dc2ae4 to your computer and use it in GitHub Desktop.
liệt kê tất cả các user có trong github account
$TEN_CUA_BAN = "tbvinh"
$all_users = @()
# 1. Lấy danh sách tất cả các repo
$repos = gh repo list $TEN_CUA_BAN --limit 1000 --json name --jq '.[].name'
Write-Host "Đang quét tất cả repositories, vui lòng đợi..." -ForegroundColor Cyan
# 2. Duyệt qua từng repo để lấy danh sách user
foreach ($repo in $repos) {
# Lấy login của tất cả collaborators trong repo này
$users = gh api "/repos/$TEN_CUA_BAN/$repo/collaborators" --jq '.[].login' 2>$null
if ($users) {
$all_users += $users
}
}
# 3. Lọc ra các user duy nhất và loại bỏ chính bạn (nếu muốn)
$unique_users = $all_users | Select-Object -Unique | Where-Object { $_ -ne $TEN_CUA_BAN }
Write-Host "`nDanh sách các user duy nhất đang có quyền truy cập (ngoại trừ bạn):" -ForegroundColor Green
$unique_users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment