Git无法初始化子模块

时间:2018-11-24 10:31:06

标签: git git-submodules

我在使用“ git submodule add”创建的子模块初始化时遇到麻烦。

我尝试过:

git clone --recursive

git clone —recurse-submodules -j8

git submodule init 
git submodule update

git submodule status

git submodule deinit --all
git submodule init 

每次输出为空

我的.gitmodules(使用git子模块添加创建...):

[submodule "vendor/src/github.com/gorilla/mux"]
    path = vendor/src/github.com/gorilla/mux
    url = https://github.com/gorilla/mux
[submodule "vendor/src/github.com/auth0/go-jwt-middleware"]
    path = vendor/src/github.com/auth0/go-jwt-middleware
    url = https://github.com/auth0/go-jwt-middleware
[submodule "vendor/src/github.com/dgrijalva/jwt-go"]
    path = vendor/src/github.com/dgrijalva/jwt-go
    url = https://github.com/dgrijalva/jwt-go
[submodule "vendor/src/github.com/urfave/negroni"]
    path = vendor/src/github.com/urfave/negroni
    url = https://github.com/urfave/negroni
[submodule "vendor/src/github.com/gorilla/handlers"]
    path = vendor/src/github.com/gorilla/handlers
    url = https://github.com/gorilla/handlers
[submodule "vendor/src/github.com/sirupsen/logrus"]
    path = vendor/src/github.com/sirupsen/logrus
    url = https://github.com/Sirupsen/logrus
[submodule "vendor/src/github.com/couchbase/gocb"]
    path = vendor/src/github.com/couchbase/gocb
    url = https://github.com/couchbase/gocb
[submodule "vendor/src/github.com/google/uuid"]
    path = vendor/src/github.com/google/uuid
    url = https://github.com/google/uuid
[submodule "vendor/src/github.com/opentracing/opentracing-go"]
    path = vendor/src/github.com/opentracing/opentracing-go
    url = https://github.com/opentracing/opentracing-go
[submodule "vendor/src/github.com/golang/snappy"]
    path = vendor/src/github.com/golang/snappy
    url = https://github.com/golang/snappy
[submodule "vendor/src/golang.org/x/net"]
    path = vendor/src/golang.org/x/net
    url = https://github.com/golang/net
[submodule "vendor/src/golang.org/x/text"]
    path = vendor/src/golang.org/x/text
    url = https://github.com/golang/text
[submodule "vendor/src/github.com/satori/go.uuid"]
    path = vendor/src/github.com/satori/go.uuid
    url = https://github.com/satori/go.uuid

我正在使用Git 2.19.2.windows.1

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

每次添加一个子模块时,都应该看到正在创建/填充的相应子文件夹以及要引用的远程存储库的内容。

因此vendor / src / github.com / gorilla / mux应该用https://github.com/auth0/go-jwt-middleware填写

完成后,由于没有其他修改,因此public int[] notAlone(int[] nums, int val) { for(int k = 1 ; k<nums.length; k++) { if(k!= nums.length-1) { int max = nums[k]; if(nums[k-1]>nums[k]) max = nums[k-1]; else if(nums[k+1] > nums[k]) max = nums[k+1]; if(nums[k-1] != nums[k] && nums[k] != nums[k+1]) nums[k] = max; } } return nums; } 之类的命令将不返回任何内容:初始化/更新已完成,并且状态无任何报告。

但是请首先尝试go 1.11 modulesgo mod vendor会为您完成销售,并避免使用git子模块,这对于常规的go项目可能是不需要的。
从那里:git submodule update/init/status足以构建您的项目。