I have a GitLab server created with docker , her is my docker compose file;
networks:
web_net:
name: web_net
external: true
app_net:
name: app_net
external: true
volumes:
gitlab_backup:
name: gitlab_backup
gitlab_data:
name: gitlab_data
gitlab_logs:
name: gitlab_logs
gitlab_config:
name: gitlab_config
services:
gitlab:
image: gitlab/gitlab-ce:${GITLAB_IMAGE_TAG}
container_name: ${GITLAB_CONTAINER_NAME}
restart: always
hostname: ${GIT_DOMAIN}
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://${GIT_DOMAIN}'
# Change the initial default admin password
gitlab_rails['initial_root_password'] = "${GITLAB_ROOT_PASSWORD}"
# Gitlab registry config
registry_external_url 'https://${RIGISTRY_SUB}.${DOMAIN_ADDRESS}'
# gitlab backup config
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab_rails['backup_archive_permissions'] = 0644
gitlab_rails['backup_keep_time'] = 604800
gitlab_rails['env'] = {"SKIP" => "registry"}
volumes:
- gitlab_backup:/var/opt/gitlab/backups
- gitlab_data:/var/opt/gitlab
- gitlab_logs:/var/log/gitlab
- gitlab_config:/etc/gitlab
ports:
- "4848:22"
- "80:80"
- "5100:5100"
- "443:443"
networks:
- web_net
my gitlab server version is 17.11.2 ce
here is how I tried to create SSH key:
ssh-keygen -t rsa -b 4096 -C "gitlab"
cat ~/.ssh/id_rsa.pub
Copy the entire output of the id_rsa.pub file.
Add the Key to GitLab:
Go to GitLab and log in.
In the top-right corner, click on your profile picture and select Preferences.
In the left menu, click SSH Keys.
Paste your copied public key into the Key field.
You can give it a descriptive title (like “My Laptop” or “Work PC”).
Click Add key.
after that I try test :
ssh -T git@gitlab.mecan.debianproject.com
git@gitlab.mecan.debianproject.com's password:
it is always ask me password. I tested the key in gitlab.com and it works perfectly, I don’t know maybe I need configure SSH in config file.
anyone have same experience?