Facing an issue with pulling the repository while dealing with an expired SSL certificate.
[vamshi@workstation ~]$ git pull https://gitlab.linuxcent.com/linuxcent/pipeline-101.git fatal: unable to access 'https://gitlab.linuxcent.com/linuxcent/pipeline-101.git/': Peer's Certificate has expired. [vamshi@workstation ~]$
SSL error while cloning git URL
If you have faced the error, then we can work around it by ignoring SSL certificate check and continue working with the git repo.
[vamshi@workstation ~]$ git clone https://gitlab.linuxcent.com/linuxcent/pipeline-101.git Cloning into 'pipeline-101'... fatal: unable to access 'https://gitlab.linuxcent.com/linuxcent/pipeline-101.git/': Peer's Certificate has expired.
It doesn’t allow the clone or pull or push to the gitlab website as its certificate is not valid, and the certificate is unsigned by a Valid CA. In most cases, we will have the corporate gitlab repo in our internal network and not publicly exposed.
We therefore trust the gitlab server as we have a bunch of our code on it.. Why not, I say?
We have to ensure to disable the check for the SSL certificate verification
Set the Variable
GIT_SSL_NO_VERIFY=false and try to execute your previous command.
[vamshi@workstation ~]$ GIT_SSL_NO_VERIFY=1 git clone https://gitlab.linuxcent.com/linuxcent/pipeline-101.git Cloning into 'pipeline-101'... Username for 'https://gitlab.linuxcent.com': vamshi Password for 'https://firstname.lastname@example.org': remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done.
Make a permanent entry to system wide user level profiles as below. The following change works at the system level
[vamshi@workstation ~]$ sudo bash -c "echo -e export GIT_SSL_NO_VERIFY=1 > /etc/profile.d/gitconfig.sh "
[vamshi@workstation ~]$ cat /etc/profile.d/gitconfig.sh export GIT_SSL_NO_VERIFY=false
The practical use case of setting the environment variable can be made while building container images, using the
GIT_SSL_NO_VERIFY false as an environment variable in Dockerfile and building an image.
[vamshi@workstation ~]$ cat Dockerfile FROM jetty:latest -- CONTENT TRUNCATED -- env GIT_SSL_NO_VERIFY 1 -- CONTENT TRUNCATED --
We can also setup the container build agent with Jenkins Pipeline code with similar configuration to fetch a gitrepo in our next sessions.
Why is git clone not working?
If you have a problem cloning a repository, or using it once it has been created, check the following: Make sure that the path in the git clone call is correct. … If you have an authorization error, have an administrator check the ACLs in Administration > Repositories > <repoName> > Access.
How do I fix fatal unable to access?
How to resolve “git pull,fatal: unable to access ‘https://github.com… \’: Empty reply from server”
- If you have configured your proxy for a VPN, you need to login to your VPN to use the proxy.
- to use it outside the VPN use the unset command: git config –global –unset http.proxy.
How do I bypass SSL certificate in git?
Prepend GIT_SSL_NO_VERIFY=true before every git command run to skip SSL verification. This is particularly useful if you haven’t checked out the repository yet. Run git config http. sslVerify false to disable SSL verification if you’re working with a checked out repository already.
How do I open a cloned git repository?
Clone Your Github Repository
- Open Git Bash. If Git is not already installed, it is super simple. …
- Go to the current directory where you want the cloned directory to be added. …
- Go to the page of the repository that you want to clone.
- Click on “Clone or download” and copy the URL.
Can not clone from GitHub?
If you’re unable to clone a repository, check that:
You can connect using HTTPS. For more information, see “HTTPS cloning errors.”
You have permission to access the repository you want to clone. For more information, see “Error: Repository not found.”
The default branch you want to clone still exists.
Do I need git for GitLab?
To install GitLab on a Linux server, you first need Git software. We explain how to install Git on a server in our Git tutorial. Next, you should download the GitLab omnibus package from the official GitLab website.
How do I clone a project from GitHub?
Cloning a repository
- In the File menu, click Clone Repository.
- Click the tab that corresponds to the location of the repository you want to clone. …
- Choose the repository you want to clone from the list.
- Click Choose… and navigate to a local path where you want to clone the repository.
- Click Clone.
How do I push code to GitHub?
Using Command line to PUSH to GitHub
- Creating a new repository. …
- Open your Git Bash. …
- Create your local project in your desktop directed towards a current working directory. …
- Initialize the git repository. …
- Add the file to the new local repository. …
- Commit the files staged in your local repository by writing a commit message.