@@ -109,14 +109,26 @@ To create a group access token:
...
@@ -109,14 +109,26 @@ To create a group access token:
1. Run the following commands in a [Rails console](../../../administration/operations/rails_console.md):
1. Run the following commands in a [Rails console](../../../administration/operations/rails_console.md):
```ruby
```ruby
admin=User.find(1)# group admin
# Set the GitLab administration user to use. If user ID 1 is not available or is not an adinistrator, use 'admin = User.admins.first' instead to select an admininistrator.
group=Group.find(109)# the group you want to create a token for
admin=User.find(1)
bot=Users::CreateService.new(admin,{name: 'group_token',username: "group_#{group.id}_bot",email: "group_#{group.id}_bot@example.com",user_type: :project_bot}).execute# create the group bot user
# for further group access tokens, the username should be group_#{group.id}_bot#{bot_count}, e.g. group_109_bot2, and their email should be group_109_bot2@example.com
# Set the group group you want to create a token for. For example, group with ID 109.
bot.confirm# confirm the bot
group=Group.find(109)
group.add_user(bot,:maintainer)# add the bot to the group at the desired access level
token=bot.personal_access_tokens.create(scopes:[:api,:write_repository],name: 'group_token')# give it a PAT
# Create the group bot user. For further group access tokens, the username should be group_#{group.id}_bot#{bot_count}. For example, group_109_bot2 and email address group_109_bot2@example.com.