markdown 尝试在OSGE4W shell中使用cURL时出现证书错误的解决方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 尝试在OSGE4W shell中使用cURL时出现证书错误的解决方法相关的知识,希望对你有一定的参考价值。

## Problem

When trying to use cURL from the **OSGEO4W** shell, it throws the following error:
 
> curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html<br><br>
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

While this seems to be a chronic issue, I couldn't find any indication that cURL or GDAL devs thought this was their repsonsibility. So, off to try and find a workaround.

## Workaround

From what I can ascertain, there is a missing certificate in the compilation of cURL that comes with **OSGEO4W**. Fortunately, [someone was kind enough to share the steps they took to workaround this issue](https://superuser.com/a/442797/988954). They were having problems with cURL on Windows more generally, but the steps are more or less the same. I've adapted them for **OSGEO4W** shell:

1. From [http://curl.haxx.se/docs/caextract.html](http://curl.haxx.se/docs/caextract.html) , Download the `cacert.pem` file.
2. Navigate to the location of cURL in your **OSGEO4W** installation. For me this was `C:\OSGeo4W64\bin`. Place `cacert.pem` in this directory.
3. Rename `cacert.pem` file to `curl-ca-bundle.crt`

At this point you should be able to run cURL from the the **OSGEO4W** shell.

以上是关于markdown 尝试在OSGE4W shell中使用cURL时出现证书错误的解决方法的主要内容,如果未能解决你的问题,请参考以下文章

markdown 在Docker for Mac Moby VM中获取Shell

shell中curl请求变更使用markdown

shell中curl请求变更使用markdown

markdown Shell特殊变量:Shell 0,#,*,@,?,$和命令行参数

markdown [All About Shell]关于shell的信息#shell #bash #sh

markdown [CLI,Shell等]#awesome-list #shell #cli