In the development. Sometimes we may be using git to introduce another Git repository under the project directory from the Web.
Such as. When I use the Vendor directory to store my Golang dependent libraries. Because the library in this directory is golang.org in the country is difficult to get through the normal way, often in go get error. So we usually clone it with GitHub and copy it to the golang.org directory.
Golang.org.png
When I add it using git Add. will give me an error.
Add.png
warning:adding embedded git repository:vendor/golang.org/x/cryptohint:you ' ve added another git Repository inside your current repository.hint:Clones of the outer repository would not contain the contents ofhint:the E Mbedded repository and won't know how to obtain it.hint:If we meant to add a submodule use:hint:hint:git Submodul E add <url> vendor/golang.org/x/cryptohint:hint:if added this path by mistake, you can remove it from Thehint: Index With:hint:hint:git RM--cached vendor/golang.org/x/cryptohint:hint:see "git help submodule" for more information . warning:adding embedded git repository:vendor/golang.org/x/lintwarning:adding embedded git repository:vendor/golang . org/x/netwarning:adding embedded git repository:vendor/golang.org/x/syswarning:adding embedded git repository: vendor/golang.org/x/textwarning:adding embedded git repository:vendor/golang.org/x/tools
It means that we have nested other libraries under our project. This is a hint that we either use submodule to manage the nested git library or delete the library. I just want to simply submit this dependency with the project. Do you want to be like this?
Solution for deleting files
Go to each directory and delete the. git directory. This will allow you to continue submitting your code.
rm -rf vendor/golang.org/x/lint/.gitrm -rf vendor/golang.org/x/net/.git rm -rf vendor/golang.org/x/sys/.git rm -rf vendor/golang.org/x/text/.git rm -rf vendor/golang.org/x/tools/.git
Eggs, look. We can continue to submit the code, really happy, life should be so beautiful.
Ojbk.png
Submodule Approach Solution
Not yet studied, it is said to be a bit troublesome.
Ignore file Solutions
Write this directory in the. gitignore file just fine.