Submodule project died, how to import the code?

My project has a particular submodule that, since 2 days is no more live. The authors ha removed the repository at all from github.

I need to know how to remove the submodule without loosing the code.

Actually the submodule is located into

project_root/external_modules/name_of_died_project

I need to keep the code in the same position. I don'r want to pushit to a separeted NEW repo.

The code of the last commit is actually on my drive. It's not that I cannot push into a new repo.. i DONT'WANT to do it. I simply want to keep the code and handle them as a simple standard subdirectory of the project, without change any path config


The submodule is an individual Git repository itself. That means you can push a copy of it to your own GitHub account. To do so do the following:

Change to the submodule

cd path/to/submodule

and push everything to your repo on GitHub (or wherever you prefer, simply replace the URL)

git push git@github.com:your-username/your-repo.git --all

You should see a copy of the repo on your GitHub account.

Afterwards follow these instructions to change the submodule URL in your parent project:

In your main project open the file .gitmodules , search for the corresponding submodule block

[submodule "path/to/submodule"]
    path = path/to/submodule
    url = https://github.com/dead-account/dead-repo.git

and replace the old dead URL with your new one from above. Then run

git submodule sync

and commit the changes

git commit -am "Fixed disappeared submodule upstream"
链接地址: http://www.djcxy.com/p/92326.html

上一篇: Git子模块在它是GitHub库时会被推入?

下一篇: 子模块项目死了,如何导入代码?