Git nested warehouse Management

Source: Internet
Author: User
Tags using git

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.