Gitlab notes
InstallEdit
SMTP setup[1]Edit
Edit the file:
/etc/gitlab/gitlab.rb
and add relevant SMTP details similar to:
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.server" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "smtp user" gitlab_rails['smtp_password'] = "smtp password" gitlab_rails['smtp_domain'] = "example.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
I inspected my SMTP settings in a known-good mail client (Thunderbird) Then reconfigure Gitlab by executing:
gitlab-ctl reconfigure
Generate SSH keys to apply to a Gitlab account[2]Edit
Run ssh-keygen to generate the key (on the server).
ssh-keygen -t ed25519 -C "<comment>"
The comment is included in the .pub file that’s created. You may want to use an email address for the comment. Output similar to the following is displayed:
Generating public/private ed25519 key pair. Enter file in which to save the key (/home/user/.ssh/id_ed25519):
Accept the suggested filename and directory, unless you are generating a deploy key or want to save in a specific directory where you store other keys.
Specify a passphrase.
A confirmation is displayed, including information about where your files are stored. A public and private key are generated. Copy the public key to your Gitlab account (i.e. in the web interface). https://docs.gitlab.com/ee/user/ssh.html#add-an-ssh-key-to-your-gitlab-account
Optimising for small server[3]Edit
Edit:
/etc/gitlab/gitlab.rb
Note that there are many more options to try in the reference. These massively improved my situation:
puma['worker_processes'] = 0 sidekiq['max_concurrency'] = 10 prometheus_monitoring['enable'] = false
Then reconfigure Gitlab by executing:
gitlab-ctl reconfigure
Convert an existing VS solution folder into a git repo and create a new gitlab project and upload it[4]Edit
Use the git bash interface and enter commands like:
cd "C:\Users\dave\source\repos\myWickedProject" git init nano .gitignore --> add line: *.vsidx git add . git checkout -b master git commit -m "Initial commit from cmdline" git config --global http.proxy '' git push --set-upstream https://myscmserver.com/dave/myWickedProject.git master
No need to create a blank project first.
Fix reposEdit
git fsck git gc
Fixing SSL problems[5]Edit
ReasonEdit
This problem is occuring because git cannot complete the https handshake with the git server were the repository you are trying to access is present.
SolutionEdit
Steps to get the certificate from the github server
- Open the github you are trying to access in the browser
- Press on the lock icon in the address bar > click on 'certificate'
- Go to 'Certification Path' tab > select the top most node in the hierarchy of certificates > click on 'view certificate'
- Now click on 'Details' and click on 'Copy to File..' > Click 'Next' > Select 'Base 64 encoded X509 (.CER)' > save it to any of your desired path.
Steps to add the certificate to local git certificate store
- Now open the certificate you saved in the notepad and copy the content along with --Begin Certificate-- and --end certificate--
- To find the path were all the certificates are stored for your git, execute the following command in cmd. git config --list
- Check for the key 'http.sslcainfo', the corresponding value will be path.
Note: If u can't find the key http.sslcainfo check for Git's default path: C:\Program Files\Git\mingw64\ssl\certs
- Now open 'ca-bundle.crt' present in that path.
Note 1 : open this file administrator mode otherwise you will not be able to save it after update. (Tip - you can use Notepad++ for this purpose) Note 2 : Before modifying this file please keep a backup elsewhere.
- Now copy the contents of file mentioned in step 1 to the file in step 4 at end file, like how other certificates are placed in ca-bundle.crt.
- Now open a new terminal and now you should be able to perform operations related to the git server using https.
TipsEdit
Temporarily switch to a different commit[6]Edit
If you want to temporarily go back to it, fool around, then come back to where you are, all you have to do is check out the desired commit:
<# This will detach your HEAD, that is, leave you with no branch checked out: git checkout 0d1d7fc32
Or if you want to make commits while you're there, go ahead and make a new branch while you're at it:
git checkout -b old-state 0d1d7fc32
To go back to where you were, just check out the branch you were on again. (If you've made changes, as always when switching branches, you'll have to deal with them as appropriate. You could reset to throw them away; you could stash, checkout, stash pop to take them with you; you could commit them to a branch there if you want a branch there.)
Reverting Working Copy to Most Recent CommitEdit
To revert to the previous commit, ignoring any changes:
git reset --hard HEAD
where HEAD is the last commit in your current branch
ReferencesEdit
- ↑ https://docs.gitlab.com/omnibus/settings/smtp
- ↑ https://docs.gitlab.com/ee/user/ssh.html
- ↑ https://docs.gitlab.com/omnibus/settings/memory_constrained_envs.html
- ↑ https://stackoverflow.com/questions/33101962/how-to-create-a-new-gitlab-repo-from-my-existing-local-git-repo-using-cli
- ↑ https://stackoverflow.com/questions/23885449/unable-to-resolve-unable-to-get-local-issuer-certificate-using-git-on-windows
- ↑ https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit