Skip to content

Instantly share code, notes, and snippets.

@timurvafin
Created July 24, 2013 15:46
Show Gist options
  • Save timurvafin/6071793 to your computer and use it in GitHub Desktop.
Save timurvafin/6071793 to your computer and use it in GitHub Desktop.
Copy members from one Github team to other
#!/usr/bin/env ruby
# copy members from one team to other
require 'json'
source_team_id =
target_team_id =
token = ''
raw_response = `curl -H "Authorization: token #{token}" https://api.github.com/teams/#{source_team_id}/members`
members = JSON.parse(raw_response).map { |m| m['login'] }
members.each do |member|
puts `curl -X PUT -d '' -H "Authorization: token #{token}" https://api.github.com/teams/#{target_team_id}/members/#{member}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment