Search code examples
gitgithubgit-submodules

Pushing the changes to the git repos inside a cloned git repo to my private git repo


I have git cloned phosa git repo which depends on 3 other git repos. I have git cloned those three and have modified their codes as needed. I now want to push the changes to my private git repo but I get the following warning.

How can I push the changes for these 3 git repo cloned inside the phosa repo by me?

$ git add .
warning: adding embedded git repository: external/detectron2
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint: 
hint:   git submodule add <url> external/detectron2
hint: 
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint: 
hint:   git rm --cached external/detectron2
hint: 
hint: See "git help submodule" for more information.
warning: adding embedded git repository: external/frankmocap
warning: adding embedded git repository: external/multiperson

Here's my git status results:

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   .gitignore
    new file:   PHOSA_demo.ipynb
    new file:   external/detectron2
    new file:   external/frankmocap
    new file:   external/multiperson
    new file:   input.jpg
    modified:   phosa/pose_optimization.py
    modified:   requirements.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
    modified:   external/frankmocap (modified content)
    modified:   external/multiperson (modified content)

Solution

  • The way I fixed this problem is creating two git repo for the changes I have made to these submodules and also ignoring them in the actual repo using .gitignore:

    $ git remote set-url origin https://github.com/monacv/frankmocap.git