-3

I have two repositories A and B in github. I have clone repo B inside one of the A's folders and now i want to update repo A and push the folder gotten from repo B inside github using Clion, and what i get is this kind of folder in repo A which is empty and not clickable:

I want to know how i can update repo A and also repo B with this kind of situation in Clion.

Inigo
  • 12,186
  • 5
  • 41
  • 70
masoud
  • 1
  • 5
  • 1
    Have a look at git submodules: https://git-scm.com/book/en/v2/Git-Tools-Submodules – thchp Dec 07 '21 at 13:09
  • 1
    Does this answer your question? [Nested Git repositories?](https://stackoverflow.com/questions/1871282/nested-git-repositories). Also search SO with `git nest repository` and `git nest repo` – Inigo Dec 07 '21 at 13:36
  • I want to do it in clion, is there any option for it? – masoud Dec 07 '21 at 14:29
  • Clion can handle submodules/nested repositories. Once you have it added, please make sure that all repositories are listed Preferences | Version Control | Directory Mappings – Ruslan Kuleshov Dec 07 '21 at 19:16
  • @RuslanKuleshov I have both repos in that setting and both of them are git as VCS. What i can do is that i can update repo B from repo A, but i still cant add those folders to repo A! – masoud Dec 07 '21 at 22:37

1 Answers1

1

You can not work with a repository inside another repository in this way. The best thing to do would be to create two separate repositories and then use the repository that you want inside a folder as a submodule. This will allow you to update the second (submodule) at the same time when you update the first repository.

See here for more info.

Joshua Zeltser
  • 488
  • 2
  • 9