# Issue committing git repository - warning: adding embedded git repository: lib/cf

**URL:** <https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345>\
**Category:** Nitrogen Forum\
**Tags:** troubleshooting, nitrogen-questions, beginner, git\
**Created:** [April 26, 2022, 2:03am UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345 "2022-04-26T02:03:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ookma-Kyi](https://erlangforums.com/user_avatar/erlangforums.com/ookma-kyi/32/1207_2.png) [@Ookma-Kyi](https://erlangforums.com/u/Ookma-Kyi)\
**Post date:** [April 26, 2022, 2:03am UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/1 "2022-04-26T02:03:27Z")

</div>

I’m trying to commit the initial project directory nitrogen created. However some directories in the lib directory can’t be added for example:

```erlang
ookma@MSI MINGW64 /e/ookma-kyi (master)
$ git add *
warning: adding embedded git repository: lib/cf
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> lib/cf
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached lib/cf
hint:
hint: See "git help submodule" for more information.

```

What is the proper procedure for committing a nitrogen project?

Update:

Getting stuck at:

> Changes not staged for commit:  
> (use “git add …” to update what will be committed)  
> (use “git restore …” to discard changes in working directory)  
> (commit or discard the untracked or modified content in submodules)  
> modified: lib/fs (untracked content)  
> modified: lib/mimetypes/ (untracked content)  
> modified: lib/qdate/ (untracked content)  
> modified: lib/qdate\_localtime/ (untracked content)

Removing it via rm -f --cached I get stuck at

```erlang
> 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: lib/mimetypes/ (untracked content)
> modified: lib/qdate/ (untracked content)
> modified: lib/qdate_localtime/ (untracked content)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        lib/fs/
        lib/mimetypes/
        lib/qdate/
        lib/qdate_localtime/

```

Readding lib/fs:

```erlang
$ git add lib/fs
warning: adding embedded git repository: lib/fs
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> lib/fs
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached lib/fs
hint:
hint: See "git help submodule" for more information.

```

I am basically stuck on a loop. 🤬

---

<div class="post-metadata">

**Author:** ![Ookma-Kyi](https://erlangforums.com/user_avatar/erlangforums.com/ookma-kyi/32/1207_2.png) [@Ookma-Kyi](https://erlangforums.com/u/Ookma-Kyi)\
**Post date:** [April 26, 2022, 3:02pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/2 "2022-04-26T15:02:41Z")

</div>

Update:

I just did some more research this morning and noted there are git repositories in the afflicted library folders.

![image](https://i.imgur.com/5HVMOlk.png)

![image](https://i.imgur.com/3RpjLSv.png)

I have not seen this before, is it normal?

---

<div class="post-metadata">

**Author:** ![lgmfred](https://erlangforums.com/user_avatar/erlangforums.com/lgmfred/32/1359_2.png) [@lgmfred](https://erlangforums.com/u/lgmfred)\
**Post date:** [April 26, 2022, 4:21pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/3 "2022-04-26T16:21:48Z")

</div>

Hello @Ookma-Kyi, your problem can easily be solved by adding `lib/*` on a new line in the `.gitignore` file located in the root directory of your project.

Basically when you initialise a git repository and then run `git add .`, git will want to track every single file in that directory (including subdirectories). But, projects will always have numerous, or at-least some, files we would rather not track. So we include the names of such files and directories in `.gitignore` to tell git _“Hey Mr. Man, I beg you not to track these files”_.

Since you’re on nitrogen, just copy the content of [this](https://github.com/BuildItWithNitrogen/nnote/blob/master/.gitignore) file and paste it in your `.gitignore` file. You may also want to have a look at [this](https://github.com/github/gitignore/blob/main/Erlang.gitignore) `.gitignore` template; probably after going deeper into Erlang and doing some more reading about git like [here](https://git-scm.com/book/en/v2) for example.

---

<div class="post-metadata">

**Author:** ![OvermindDL1](https://erlangforums.com/user_avatar/erlangforums.com/overminddl1/32/398_2.png) [@OvermindDL1](https://erlangforums.com/u/OvermindDL1)\
**Post date:** [April 26, 2022, 4:46pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/4 "2022-04-26T16:46:00Z")

</div>

> [@lgmfred](#):
>
> Since you’re on nitrogen, just copy the content of [this](https://github.com/BuildItWithNitrogen/nnote/blob/master/.gitignore) file and paste it in your `.gitignore` file. You may also want to have a look at [this](https://github.com/github/gitignore/blob/main/Erlang.gitignore) `.gitignore` template; probably after going deeper into Erlang and doing some more reading about git like [here](https://git-scm.com/book/en/v2) for example.

Are submodules or a dependency acquire setup or something? You still want it to build when you do a fresh `git clone` after all.

---

<div class="post-metadata">

**Author:** ![Ookma-Kyi](https://erlangforums.com/user_avatar/erlangforums.com/ookma-kyi/32/1207_2.png) [@Ookma-Kyi](https://erlangforums.com/u/Ookma-Kyi)\
**Post date:** [April 26, 2022, 10:39pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/5 "2022-04-26T22:39:48Z")

</div>

That’s the thing, I have used git before with subdirectories and sub-subdirectories and never encountered this type of setup. What are submodules or “dependency acquire”? Are you talking about the rebar 2/3 dependency manager?

---

<div class="post-metadata">

**Author:** ![gumm](https://erlangforums.com/user_avatar/erlangforums.com/gumm/32/688_2.png) [@gumm](https://erlangforums.com/u/gumm)\
**Post date:** [April 26, 2022, 10:46pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/6 "2022-04-26T22:46:56Z")

</div>

In this case, the submodules are just dependencies that are pulled by rebar. Following @lgmfred’s advice to copy that `.gitignore` file should help. You do not need to add any of the files in `lib` to your git repo - rebar will automatically pull them if they don’t exist.

---

<div class="post-metadata">

**Author:** ![gumm](https://erlangforums.com/user_avatar/erlangforums.com/gumm/32/688_2.png) [@gumm](https://erlangforums.com/u/gumm)\
**Post date:** [April 30, 2022, 5:38pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/7 "2022-04-30T17:38:39Z")

</div>

I’ve updated both the default .gitignore and the merge-configs script in the default windows installation, so if you pull from master, it’ll give fewer issues.

---

<div class="post-metadata">

**Author:** ![Ookma-Kyi](https://erlangforums.com/user_avatar/erlangforums.com/ookma-kyi/32/1207_2.png) [@Ookma-Kyi](https://erlangforums.com/u/Ookma-Kyi)\
**Post date:** [April 30, 2022, 8:47pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/8 "2022-04-30T20:47:15Z")

</div>

I used the instructions provided by @lgmfred [here](https://erlangforums.com/t/build-it-with-nitrogen-help/1338/5) and installed the Git For Windows SDK. How do i update my Nitrogen installation?

---

<div class="post-metadata">

**Author:** ![gumm](https://erlangforums.com/user_avatar/erlangforums.com/gumm/32/688_2.png) [@gumm](https://erlangforums.com/u/gumm)\
**Post date:** [April 30, 2022, 9:24pm UTC](https://erlangforums.com/t/issue-committing-git-repository-warning-adding-embedded-git-repository-lib-cf/1345/9 "2022-04-30T21:24:36Z")

</div>

Basically, you can just download [https://raw.githubusercontent.com/nitrogen/nitrogen/master/rel/overlay/common/.gitignore](https://raw.githubusercontent.com/nitrogen/nitrogen/master/rel/overlay/common/.gitignore) and replace that same file in the root of your generated installation.

You’ve already replaced the `merge-configs` file, so that should be good to go.

For future generated projects, you could just do `git pull` from your nitrogen directory.
