从GitHub下载同文trime输入法时因为墙的原因,导致无法链接到GitHub,特别是子模块没法下载。经过这几天的尝试找到一条解决方法如下:
# 1. 使用代理
git clone https://ghproxy.com/https://github.com/osfans/trime.git
# 2. 当中一些子模块不会下下来
# 修改.gitmodules文件,每条url加上https://ghproxy.com。如url = https://ghproxy.comhttps://github.com/BYVoid/OpenCC.git
[submodule "app/src/main/jni/OpenCC"]
path = app/src/main/jni/OpenCC
url = https://github.com/BYVoid/OpenCC.git
[submodule "app/src/main/jni/snappy"]
path = app/src/main/jni/snappy
url = https://github.com/google/snappy.git
[submodule "app/src/main/jni/boost"]
path = app/src/main/jni/boost
url = https://github.com/boostorg/boost.git
[submodule "app/src/main/jni/librime"]
path = app/src/main/jni/librime
url = https://github.com/rime/librime.git
ignore = dirty
[submodule "app/src/main/jni/libiconv"]
path = app/src/main/jni/libiconv
url = https://github.com/osfans/libiconv-gnu.git
[submodule "app/src/main/jni/librime-lua"]
path = app/src/main/jni/librime-lua
url = https://github.com/hchunhui/librime-lua
ignore = dirty
[submodule "app/src/main/jni/librime-lua-deps"]
path = app/src/main/jni/librime-lua-deps
url = https://github.com/hchunhui/librime-lua
branch = thirdparty
[submodule "app/src/main/jni/librime-octagram"]
path = app/src/main/jni/librime-octagram
url = https://github.com/lotem/librime-octagram.git
[submodule "app/src/main/jni/capnproto"]
path = app/src/main/jni/capnproto
url = https://github.com/capnproto/capnproto.git
[submodule "app/src/main/jni/librime-charcode"]
path = app/src/main/jni/librime-charcode
url = https://github.com/rime/librime-charcode
# 3. 不断执行命令
git submodule update --init --recursive
会有些子模块下不下来,我猜是墙的存在需要做很多检测,时间一长就断线了。因此要不断执行上面那句句,待墙检测完了就可以下下来。
此时任然有一个问题就是boost子模块里还嵌套着子模块,boost中有些子模块下载下来的是空文件夹且无论执行多少次git submodule update --init --recursive都没用。原因是这些空文件夹中都有一个隐形的.git文件,将.git文件删除重新执行git submodule update --init --recursive就可以下载下来。此时cd 到boost中,具体操作如下:
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ find libs/ -name .git
libs/callable_traits/.git
libs/polygon/.git
libs/rational/.git
:
:
# 会出现很多.git文件,都删掉
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ find libs/ -name "*.git" | xargs rm -f
# 再执行就能将原来空的子模块文件夹
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule update --init --recursive
以下是部分记录
jek@jek-virtual-machine:~/trime$ ^C
jek@jek-virtual-machine:~/trime$ git clone https://ghproxy.com/https://github.com/stilleshan/ServerStatus
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$ cd trime
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ vim .gitmodules
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ git submodule update --init --recursive
jek@jek-virtual-machine:~/trime/trime$
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/leveldb'...
fatal: unable to access 'https://github.com/google/leveldb.git/': GnuTLS recv error (-54): Error in the pull function.
fatal: clone of 'https://github.com/google/leveldb.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/leveldb' failed
Failed to clone 'thirdparty/src/leveldb'. Retry scheduled
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/marisa-trie'...
fatal: unable to access 'https://github.com/s-yata/marisa-trie.git/': Failed to connect to github.com port 443: Connection refused
fatal: clone of 'https://github.com/s-yata/marisa-trie.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/marisa-trie' failed
Failed to clone 'thirdparty/src/marisa-trie'. Retry scheduled
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/opencc'...
fatal: unable to access 'https://github.com/BYVoid/OpenCC.git/': Failed to connect to github.com port 443: Connection refused
fatal: clone of 'https://github.com/BYVoid/OpenCC.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/opencc' failed
Failed to clone 'thirdparty/src/opencc'. Retry scheduled
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/yaml-cpp'...
fatal: unable to access 'https://github.com/jbeder/yaml-cpp.git/': Failed to connect to github.com port 443: Connection refused
fatal: clone of 'https://github.com/jbeder/yaml-cpp.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/yaml-cpp' failed
Failed to clone 'thirdparty/src/yaml-cpp'. Retry scheduled
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/leveldb'...
fatal: unable to access 'https://github.com/google/leveldb.git/': Failed to connect to github.com port 443: Connection refused
fatal: clone of 'https://github.com/google/leveldb.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/leveldb' failed
Failed to clone 'thirdparty/src/leveldb' a second time, aborting
Cloning into '/home/jek/trime/trime/app/src/main/jni/snappy/third_party/googletest'...
fatal: unable to access 'https://github.com/google/googletest.git/': GnuTLS recv error (-54): Error in the pull function.
fatal: clone of 'https://github.com/google/googletest.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/snappy/third_party/googletest' failed
Failed to clone 'third_party/googletest'. Retry scheduled
Cloning into '/home/jek/trime/trime/app/src/main/jni/snappy/third_party/googletest'...
fatal: unable to access 'https://github.com/google/googletest.git/': Failed to connect to github.com port 443: Connection refused
fatal: clone of 'https://github.com/google/googletest.git' into submodule path '/home/jek/trime/trime/app/src/main/jni/snappy/third_party/googletest' failed
Failed to clone 'third_party/googletest' a second time, aborting
Failed to recurse into submodule path 'app/src/main/jni/librime'
Failed to recurse into submodule path 'app/src/main/jni/snappy'
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ git submodule update --init --recursive
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/leveldb'...
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/marisa-trie'...
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/opencc'...
Cloning into '/home/jek/trime/trime/app/src/main/jni/librime/thirdparty/src/yaml-cpp'...
Submodule path 'app/src/main/jni/librime/thirdparty/src/capnproto': checked out
'bb98e7b438708d432dfff13850301401a1e445b1'
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ git submodule update --init --recursive
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ ls
app build.gradle gradle gradlew.bat magic.txt PRIVACY.md README_tc.md
artwork CODE_OF_CONDUCT.md gradle.properties keystore.tar.enc Makefile README.md script
AUTHORS CONTRIBUTING.md gradlew LICENSE osfans_alipay.png README_sc.md settings.gradle
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ cd ..
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$ tar zcvf trime trime.tar.gz
tar (child): trime: Cannot opentar: trime.tar.gz: Cannot stat: Is a directory
tar (child): Error is not recoverable: exiting now
: No such file or directory
tar: Child returned status 2
tar: Error is not recoverable: exiting now
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$ tar -zcvf trime trime.tar.gz
tar: trime.tar.gz: Cannot stat: No such file or directory
tar (child): trime: Cannot open: Is a directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
jek@jek-virtual-machine:~/trime$ ls
trime
jek@jek-virtual-machine:~/trime$
jek@jek-virtual-machine:~/trime$ tar -zcvf trime.tar.gz trime
jek@jek-virtual-machine:~/trime/trime$ git pull
Already up to date.
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ git submodule update
Submodule path 'app/src/main/jni/OpenCC': checked out '53c03205671cf07d8b46d3125e16f2ba595a73e9'
Submodule path 'app/src/main/jni/boost': checked out 'a07c63c9e56f4d3b5bc904e25a7ad6f900728dbf'
Submodule path 'app/src/main/jni/capnproto': checked out 'b49431c48d40490ef979247d308af63345376cee'
Submodule path 'app/src/main/jni/libiconv': checked out '51aaded80d1986be940d9e73f7927606e316c21e'
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ git submodule update --init --recursive
jek@jek-virtual-machine:~/trime/trime$ git config --global http.lowSpeedLimit 0
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$
jek@jek-virtual-machine:~/trime/trime$ git config --global http.lowSpeedTime 999999
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git branch -a
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git config -l
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ grep path .gitmodules | sed 's/.*= //'
libs/system
libs/multi_array
libs/math
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule status --recursive
14c13370602fe86d134a948943958cab0921ce9c libs/accumulators (boost-1.77.0)
3b3bd8d3db43915c74d574ff36b4d945b6fc7917 libs/algorithm (boost-1.76.0)
0790cd45c8e05b1b59fffbc948b6bcb26eb6a2aa libs/align (boost-1.76.0)
dec5cb64a556d4a33a8a57c6a2c1ff58e7aa66ad libs/any (boost-1.78.0)
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule --quiet foreach --recursive 'echo $name'
accumulators
algorithm
align
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule sync
Synchronizing submodule url for 'libs/accumulators'
Synchronizing submodule url for 'libs/algorithm'
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git rm -r --cached libs/
rm 'libs/Jamfile.v2'
rm 'libs/accumulators'
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git branch -r
origin/HEAD -> origin/master
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule foreach git pull *
Entering 'libs/accumulators'
fatal: 'appveyor.yml' does not appear to be a git repository
fatal: Could not read from remote repository.
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule foreach git submodule update
Entering 'libs/accumulators'
Entering 'libs/algorithm'
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git reset --hard HEAD
HEAD is now at a07c63c9e5 Update asio from master
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule foreach --recursive git submodule update
Entering 'more'
Entering 'tools/auto_index'
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule foreach --recursive git submodule init
Entering 'more'
Entering 'tools/auto_index'
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git pull libs/context
warning: no common commits
remote: Enumerating objects: 7034, done.
remote: Counting objects: 100% (7034/7034), done.
remote: Compressing objects: 100% (1960/1960), done.
remote: Total 7034 (delta 4470), reused 7030 (delta 4466)
Receiving objects: 100% (7034/7034), 7.97 MiB | 34.44 MiB/s, done.
Resolving deltas: 100% (4470/4470), done.
From libs/context
* branch HEAD -> FETCH_HEAD
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule sync --recursive && git submodule update --init
Synchronizing submodule url for 'more'
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git branch
* (HEAD detached at a07c63c9e5)
master
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git submodule --quiet foreach --recursive 'echo $name'
accumulators
algorithm
align
jek@jek-virtual-machine:~/trime/trime/app/src/main/jni/boost$ git branch -a
* (HEAD detached at a07c63c9e5)
master
remotes/origin/HEAD -> origin/master
remotes/origin/circle2