最近GitHub被墻的很厲害,也可能是網(wǎng)絡(luò)被限制,導(dǎo)致打包機(jī)一直拉不下代碼,用fq工具,然后各種配置都不行。偶然發(fā)現(xiàn)gitconfig有替換URL功能,想到一個(gè)方法。先把GitHub的代碼導(dǎo)入到碼云或者你們公司的代碼平臺(tái),再更換URL映射。
很多報(bào)無法訪問錯(cuò)誤:
[!] Error installing ReactiveObjC
[!] Error installing SDWebImage
[!] Error installing SSZipArchive
[!] /usr/bin/git clone [https://github.com/ZipArchive/ZipArchive.git](https://github.com/ZipArchive/ZipArchive.git) /var/folders/6h/bhmdvd9s1rxc40_xhz9g2rww0000gn/T/d20221122-79068-1nux8ny --template= --single-branch --depth 1 --branch v1.8.1
Cloning into '/var/folders/6h/bhmdvd9s1rxc40_xhz9g2rww0000gn/T/d20221122-79068-1nux8ny'...
fatal: unable to access '[https://github.com/ZipArchive/ZipArchive.git/](https://github.com/ZipArchive/ZipArchive.git/)': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
比如替換YYText,用下面的命令:
git config --global url."https://gitee.com/xxxx/YYText.git".insteadOf https://github.com/ibireme/YYText.git
將YYText映射到自己的代碼平臺(tái),后面有庫報(bào)錯(cuò)就換掉。
上面的命令執(zhí)行完,會(huì)加到本地的 ~/.gitconfig 文件里面,也可以跳過命令直接修改該文件。
[url "https://gitee.com/xxxx/YYText.git"]
insteadOf = https://github.com/ibireme/YYText.git