debian-mirror-gitlab/doc/integration/gitlab.md

113 lines
3.9 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
2021-10-27 15:23:28 +05:30
stage: Ecosystem
group: Integrations
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2021-11-18 22:05:49 +05:30
# Integrate your server with GitLab.com **(FREE SELF)**
2015-04-26 12:48:37 +05:30
Import projects from GitLab.com and login to your GitLab instance with your GitLab.com account.
2017-08-17 22:00:37 +05:30
To enable the GitLab.com OmniAuth provider you must register your application with GitLab.com.
2021-02-22 17:27:13 +05:30
GitLab.com generates an application ID and secret key for you to use.
2015-04-26 12:48:37 +05:30
2021-03-11 19:13:27 +05:30
1. Sign in to GitLab.com.
1. In the top-right corner, select your avatar.
1. Select **Edit profile**.
2021-11-11 11:23:49 +05:30
1. On the left sidebar, select **Applications**.
2019-09-30 21:07:59 +05:30
1. Provide the required details for **Add new application**.
- Name: This can be anything. Consider something like `<Organization>'s GitLab` or `<Your Name>'s GitLab` or something else descriptive.
- Redirect URI:
2015-04-26 12:48:37 +05:30
2020-04-22 19:07:51 +05:30
```plaintext
2019-09-30 21:07:59 +05:30
http://your-gitlab.example.com/import/gitlab/callback
http://your-gitlab.example.com/users/auth/gitlab/callback
```
2015-04-26 12:48:37 +05:30
2019-09-30 21:07:59 +05:30
The first link is required for the importer and second for the authorization.
2015-04-26 12:48:37 +05:30
2019-09-30 21:07:59 +05:30
1. Select **Save application**.
2020-05-24 23:13:21 +05:30
1. You should now see an **Application ID** and **Secret**. Keep this page open as you continue
configuration.
2019-09-30 21:07:59 +05:30
1. On your GitLab server, open the configuration file.
2015-04-26 12:48:37 +05:30
2019-12-04 20:38:33 +05:30
For Omnibus package:
2015-04-26 12:48:37 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
sudo editor /etc/gitlab/gitlab.rb
```
2015-04-26 12:48:37 +05:30
2019-09-30 21:07:59 +05:30
For installations from source:
2015-04-26 12:48:37 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
cd /home/git/gitlab
2015-04-26 12:48:37 +05:30
2019-09-30 21:07:59 +05:30
sudo -u git -H editor config/gitlab.yml
```
2015-04-26 12:48:37 +05:30
2021-12-11 22:18:48 +05:30
1. See [Configure initial settings](omniauth.md#configure-initial-settings) for initial settings.
2019-09-30 21:07:59 +05:30
1. Add the provider configuration:
2015-04-26 12:48:37 +05:30
2021-11-18 22:05:49 +05:30
For Omnibus installations authenticating against **GitLab.com**:
2015-04-26 12:48:37 +05:30
2019-09-30 21:07:59 +05:30
```ruby
gitlab_rails['omniauth_providers'] = [
{
2022-01-26 12:08:38 +05:30
name: "gitlab",
# label: "Provider name", # optional label for login button, defaults to "GitLab.com"
app_id: "YOUR_APP_ID",
app_secret: "YOUR_APP_SECRET",
args: { scope: "api" }
2019-09-30 21:07:59 +05:30
}
]
```
2015-04-26 12:48:37 +05:30
2021-11-18 22:05:49 +05:30
Or, for Omnibus installations authenticating against a different GitLab instance:
```ruby
gitlab_rails['omniauth_providers'] = [
{
2022-01-26 12:08:38 +05:30
name: "gitlab",
label: "Provider name", # optional label for login button, defaults to "GitLab.com"
app_id: "YOUR_APP_ID",
app_secret: "YOUR_APP_SECRET",
args: { scope: "api", client_options: { site: "https://gitlab.example.com/api/v4" } }
2021-11-18 22:05:49 +05:30
}
]
```
For installations from source authenticating against **GitLab.com**:
2015-04-26 12:48:37 +05:30
2020-04-22 19:07:51 +05:30
```yaml
2021-01-03 14:25:43 +05:30
- { name: 'gitlab',
2022-01-26 12:08:38 +05:30
# label: 'Provider name', # optional label for login button, defaults to "GitLab.com"
2021-01-03 14:25:43 +05:30
app_id: 'YOUR_APP_ID',
app_secret: 'YOUR_APP_SECRET',
args: { scope: 'api' } }
2019-09-30 21:07:59 +05:30
```
2015-04-26 12:48:37 +05:30
2021-11-18 22:05:49 +05:30
Or, for installations from source to authenticate against a different GitLab instance:
```yaml
- { name: 'gitlab',
2022-01-26 12:08:38 +05:30
label: 'Provider name', # optional label for login button, defaults to "GitLab.com"
2021-11-18 22:05:49 +05:30
app_id: 'YOUR_APP_ID',
app_secret: 'YOUR_APP_SECRET',
args: { scope: 'api', "client_options": { "site": 'https://gitlab.example.com/api/v4' } }
```
2021-03-08 18:12:59 +05:30
1. Change `'YOUR_APP_ID'` to the Application ID from the GitLab.com application page.
1. Change `'YOUR_APP_SECRET'` to the secret from the GitLab.com application page.
2019-09-30 21:07:59 +05:30
1. Save the configuration file.
2021-03-08 18:12:59 +05:30
1. Based on how GitLab was installed, implement these changes by using
the appropriate method:
2015-04-26 12:48:37 +05:30
2021-03-11 19:13:27 +05:30
- Omnibus GitLab: [reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure).
- Source: [restart GitLab](../administration/restart_gitlab.md#installations-from-source).
2021-03-08 18:12:59 +05:30
On the sign-in page, there should now be a GitLab.com icon following the
regular sign-in form. Select the icon to begin the authentication process.
GitLab.com asks the user to sign in and authorize the GitLab application. If
everything goes well, the user is returned to your GitLab instance and is
signed in.