Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the old command of git clone -c in git version 1.7.1

Tags:

git

git-clone

ssl

I have to run a command to clone my project through git.

However my git version is quite old; my version is 1.7.1, and does not recognize the command. It show me error: unknown switchc'` error.

My command is

$ git clone -c http.sslVerify=false https://myProject:[email protected]/git/gerrit/hlbb/gib/

I believe that the -c is not a valid command on version 1.7.1. One of the solutions is upgrade the git. However, would like to ask about the command of version 1.7.1 to doing the same thing. I searched with Google but it looks like I'm not getting a good result.

like image 591
Panadol Chong Avatar asked Oct 25 '25 05:10

Panadol Chong


2 Answers

The -c or --config flag (to git clone—different from git -c key=value clone) was new in Git 1.7.7. See commit 84054f79de35015fc92f73ec4780102dd820e452. As VonC and ymonad said, in this particular case, you can get the same effect using GIT_SSL_NO_VERIFY, but in the more general case, if this configuration value affects the operation of Git and there is no other way to set it in time, you would have to break git clone into its equivalent constituent parts: git init, git config, git remote add, git fetch, and git checkout. (The git config step is required if and only if there are -c options.)

(In most cases, git clone -c key=value url) can be handled as git clone url followed by cd-ing into the new repository and setting the configuration. But this is not true for this particular configuration item.)

like image 113
torek Avatar answered Oct 26 '25 19:10

torek


The -c allows you to set a local config just for that one git command.
In this instance, it sets it after cloning.

An alternative in your case is to use an environment variable:

 GIT_SSL_NO_VERIFY=false git clone...

That variable was introduced in commit 3dcb90f in July 2005 ofr Git 0.99.2

The point is: there is no direct alternative to the lack of -c, except than to check if the local setting you want to override has a corresponding environment variable for you to set.

Once you have clone the repo, you can go into it, and do a local git config to persists the setting.
Although... I wouldn't recommend that one: checking SSL certificate is usually a good practice.

like image 31
VonC Avatar answered Oct 26 '25 18:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!