Git/GitLab

From Ever changing code
< Git
Revision as of 17:15, 18 December 2019 by Pio2pio (talk | contribs) (→‎References)
Jump to navigation Jump to search

Reset a user password

This could be also root user.

ubuntu@gitlab:~$  sudo gitlab-rails console
-------------------------------------------------------------------------------------
 GitLab:       11.4.0 (6ebbd70)
 GitLab Shell: 8.3.3
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> user = User.find_by(username: "bob")
                 user = User.find_by(id: 1)    //by id
=> #<User id:5 @bob>
irb(main):002:0> user.password = 'test1234'    //at least 8 characters long
=> "test1"
irb(main):003:0> user.password_confirmation = 'test1234'
=> "test1"
irb(main):007:0> user.unlock_access!
=> true
irb(main):008:0> user.save!
=> false

Deployment token

In course to grant access to a single repository for reading, writting or both we can use feature called Deploy Tokens. Go to repository > repository settings > Deploy Tokens to create one.

ClipCapIt-191107-092625.PNG


Access repository

# Syntax
# git clone http://<username>:<deploy_token>@gitlab.example.com/tanuki/awesome_project.git

# Example
git clone https://darkmatter:PLjeFh56F15yJeq8xrZv@gitlab.com/hackerrank1/apache-nginx-ssl.git
Cloning into 'apache-nginx-ssl'...
remote: Enumerating objects: 110, done.
remote: Counting objects: 100% (110/110), done.
...
References

GitLab CI

References