Code Snippet

Just another Code Snippet site

[How-To] Gitlab

default config file :

/etc/gitlab/gitlab.rb

reload config :

gitlab-ctl reconfigure

GIT LAb Console :
start console

gitlab-rails console production

display SMTP Config :

ActionMailer::Base.smtp_settings

Send mail

Notify.test_email('my_address@mail.com', 'Hello World', 'This is a test message').deliver_now

,


6 thoughts on “[How-To] Gitlab

  • Olivier says:

    Display ‘maintenance’ page

    gitlab-ctl deploy-page up
    gitlab-ctl deploy-page down
  • Olivier says:

    Error while doing a git clone git@….

    The project you were looking for could not be found
    

    Check in the project config (Settings/Repository/Deploy Keys) that at least a key is enabled

  • GitLab API

    curl -s -k --header "PRIVATE-TOKEN: AAAA" https://<GIT_LAB_API>/api/v4/projects/NAMESPACE%2PROJECT_NAME | jq '.id'
    
    • Archive project:

      curl --request POST --header "PRIVATE-TOKEN: AAA" https://<GITLAB_URL>/api/v4/projects/<PROJECT_ID>/archive
      

      Unarchive project:

      curl --request POST --header "PRIVATE-TOKEN: AAA" https://<GITLAB_URL>/api/v4/projects/<PROJECT_ID>/unarchive
      

      Update description:

      curl --request PUT --header "PRIVATE-TOKEN: AAA" 'https://<GITLAB_URL>/api/v4/projects/<PROJECT_ID>' --data-urlencode 'description=<NEW DESCRIPTION>'
      
  • List projects IDs from a group:

    curl -s -k --request GET --header "PRIVATE-TOKEN: <PRIVATE_TOKEN>" https://<GITLAB_URL>/api/v4/groups/<GROUP_NAME>/projects?archived=false | jq ".[].id"
    
  • Olivier says:

    Add topic/tag to a project:

    curl -X PUT --header "PRIVATE-TOKEN: <TOKEN>" "<GITLAB_URL>/api/v4/projects/<PROJECT_ID>?tag_list=topic1,topic2,topic3"
    

Leave a Reply to OLIVIER COMBE Cancel reply

Your email address will not be published. Required fields are marked *