If you receive an error when initializing Jenkins, it maybe due to skipping the user-creation step in the setup wizard. In this case, you can disable Jenkins Security and reset the password.
- Login to the Jenkins server using gcloud command.
- Install VIM text editor if it’s not availble.
- Search for vim packages run:
sudo apt search vim
- Update package
sudo apt update
- Install vim
sudo apt install vim
- Verify vim installation
vim --version
- Disable Jenkins Security
sudo vi /var/lib/jenkins/config.xml
- Edit the useSecurity line to false

<useSecurity>true</useSecurity>

Press i
to start edit mode, and set the true
value to false
<useSecurity>false</useSecurity>
Save change and quit vim by typing :wq!
Restart the Jenkins server to take effect of this change
sudo systemctl restart jenkins
Retrieve new password sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Access http://{your-jenkins-address}:8080
again and use this password to setup Jenkins.

Click Continue and continue setup following the setup wizard.