0

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

ckruczek
  • 2,361
  • 2
  • 20
  • 23
realtebo
  • 23,922
  • 37
  • 112
  • 189

1 Answers1

1

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"
Nils Werner
  • 34,832
  • 7
  • 76
  • 98
  • I edited my question. I must 'import' the code in the same position but NOT as new repository. Simply I want to add the actual code into the actual 'master' project.... I need to trasnform from a submodule into a 'normal' directory of code – realtebo Oct 06 '17 at 08:50