What Is Knowledge of Branching Strategies?

Problem scenario
You are preparing for an interview for a job (build/release engineer or DevOps engineer) where a requirement is “knowledge of branching strategies.” There are different patterns, models, paradigms, workflows and even philosophies associated with branches in repositories. What is knowledge of branching strategies in the context of code versioning systems and the CI/CD pipeline?

Solution

***Updated in January of 2022.***

Background
Open source projects may have different branching strategies from enterprises developing in-house proprietary software.

How Do You Change The Port That GitLab Listens on?

Problem scenario
By default GitLab runs on port 8080.  You want to run something else on the server with GitLab.  How do you change the port that GitLab uses?

Solution
1.  Edit the /etc/gitlab/gitlab.rb file.

Find the stanzas with for the “external_url”.

Change it from this:  http://x.x.x.x/

to this:  http://x.x.x.x:555

(where x.x.x.x is either the external IP address or FQDN of the gitlab server and 555 is the desired non-standard port number that you want GitLab to listen on).

How Do You Troubleshoot a GitLab Webhook Failing Because of “Execution expired”?

Problem scenario
You try to test an Integration, specifically a Webhook, in GitLab.  The URL is for Jenkins.  You get “Execution expired.”  What could be wrong?

Possible solution #1
See if the GitLab’s IP address or hostname changed.  If the external_url stanza in /etc/gitlab/gitlab.rb uses an old IP address or FQDN, then that may need to be updated.  You may need to run “sudo gitlab-ctl reconfigure” again. 

How Do You Troubleshoot the GitLab Integration Webhook Error “No valid crumb was included in the request”?

Problem scenario
You are trying to configure GitLab to work with Jenkins (so the two are integrated to enable CI, continual integration, in your environment).  When you test a connection of an integration webhook from GitLab to reach out to Jenkins you receive this error:

“Hook executed successfully but returned HTTP 403… No valid crumb was included in the request.”

What should you do?

Solution
Possible solution #1
Warning: This is not a recommended practice. 

How Do You Troubleshoot “permission denied” when Trying to Clone a Git Repository That You Should Have Access to?

Problem scenario
You configured the source repository (in GitHub, GitLab, in BitBucket or elsewhere) to allow your user to have permissions to read the repository.  You run git clone but you get a “permission denied” error.  What should you do?  

Possible solutions
The Linux server you are on may not give your Linux user permissions to write to the destination directory.  Can you clone the repository to the /tmp/ directory? 

Why Is a GitLab Webhook That Integrates with Jenkins Failing with a “500 …instance_identity.InstanceIdentity.get …” error?

Problem scenario
A GitLab webhook (aka integration) fails.  It used to work as an integration mechanism with Jenkins.  The GitLab error message says:

“500 <!DOCTYPE html> … at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.get(InstanceIdentity.java:133)”

Solution
Go to the Jenkins server and reinstall the GitLab plugins.

How Do You Troubleshoot the Git Error Fatal Foobar.Git Does Not Appear to Be a Git Repository?

Problem scenario
You run a git command and you get an error like this:

“fatal: ‘root/contint.git’ does not appear to be a git repository
fatal: Could not read from remote repository.”

The git command works on the server with the git repository.  But from another server you get the error above.  What should you do?

Solution
Find the full path to the git repo file. 

How Do You Clone a Git Repository when You Are Being Prompted for a Password and Do Not Know What It Is?

Problem scenario
You have a Git repository on one server.  You want to clone it to another server.  When you try to clone it, you are prompted for a password.  What do you do?

Solution
On the destination server, run this (where x.x.x.x is the IP address of the server with the Git repo):

git clone git@x.x.x.x:root/goodrepo.git

If you are prompted for a password,

How Do You Solve the Error “failed to push some refs” after a “git push origin master”?

Problem scenario
You have two Linux servers (server A and server B).  You have a Git repository on server A.  You are logged into server B as jdoe. You cloned a Git repository from server A (with a “git clone git@gitlabFQDN:/path/to/nameOfRepo.git” command).  You added some files and used “git commit” on server B.  From server B you run this command as the Linux user jdoe: git push origin master

You get this problem:

remote: GitLab: You are not allowed to upload code for this project.