breaking into the unknown…

Leave a comment

git clone problem

Recently, I am asked to create a staging instance for our project, with exact same copy of environment as of production, so that code can be tested in exact environment before deploying on production. I was given ssh access to the new server space. When, I clone the repository on my local machine, it prompt me to enter my github username and password, and on authentication clone the repository.

But, when I tried to clone the repository, after login to the new server, I get into trouble, failing to clone it with every possible way I know.

=> Tried with https url
# git clone cportal
Cloning into cportal…
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing
fatal: HTTP request failed

=> Tried with simple http url
# git clone cportal
Cloning into cportal…
(gnome-ssh-askpass:5068): Gtk-WARNING **: cannot open display:

=> Tried with ssh url
# git clone cportal
Cloning into cportal…
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly.

O.K, so I understand the problem in first case, providing https in git url, means Git is expecting ssl certificate to be present on the machine trying to clone the repo. The new server do not have any ssl certificate so, it is failing. I have reported to client to purchase the certificate and add it to the new server.

In second case i,e with http , git try to secure the cloning by asking the repository username and password, but in my case the prompt to enter username and password is not appearing, so I ‘am struck up again.

I do not know the third problem i,e why with ssh url of the repository, it is saying Repository not found . Many a time I have cloned git repository with there ssh URL, but this time it is not working.

Searching a lot, finally, I got solution in this stackoverflow thread . It is long thread, with different people suggesting different things, but is worth reading.

Basically, in this case, my solution is to tell git to not verify the SSl certificate and do authentication with username password

1 : do not verfiy SSL certificate

NOTE : I have used it for temporary workaround. do not disable SSl verification, it will risk your repository. The correct solution is to add the SSl certificate on the machine

It can be done by running any of the below two commands :

export GIT_SSL_NO_VERIFY=false #export is linux command which can set any variable from the command line

git config –global http.sslVerify false

they will tell GIt to not verify SSL certificate while, cloning, pulling or pushing over https connection.
  2: enable the password prompt

The password prompt is having some value set, which is preventing it to appear. we need to remove that. jut opposite to export command which set a variable, unset will remove that variable. So below command should be used.