0

I want to add my angular folder as a submodule to my main directory. The angular folder is initizlied as a git repository. Also, the angular folder is a local folder with no url, existing only on my windows machine.

First, I successfully initiated git init from within my main repo. Then, I added folder1 successfully with

git add folder1

But, when I try

git submodule add .\angular\.git\

or

git submodule add .\angular\

I get the error "repo URL: '.\frontend.git' must be absolute or begin with ./|../"

main repo
│
└───folder1
│   
└───angular

How can I add submodule angular to my main repo directory?

Wilfredo
  • 137
  • 1
  • 9
  • 1
    Seems you're in windows and your file path isn't accepted by git. Check out this answer to understand URI vs filepath in windows - [link](https://stackoverflow.com/questions/1589930/so-what-is-the-right-direction-of-the-paths-slash-or-under-windows) – clamentjohn Jan 29 '21 at 04:12
  • Try using `git bash` and type in `git submodule add ./angular` – clamentjohn Jan 29 '21 at 04:13

1 Answers1

0

As clmno mentioned, filepath was the problem. Flipping the slashes worked.

git submodule add ./angular/.git/

Apparently had to do with windows using backslashes and unix systems using forwardslashes.

Wilfredo
  • 137
  • 1
  • 9
  • 1
    Note that URLs also use forward slashes. Windows is generally fine with forward slashes internally, too; it's just that instead of `-f` or `--force` style options, DOS used `/f` for its `f`-option-letter, so Windows still treats forward slash as option letters, in some places. This makes it hard to distinguish between `prog /path/to/file` and `prog -p -a -t -h`. Of course on Unix systems it's hard to mention a file whose name starts with `-`, but the trick there is to use `./-file`. – torek Jan 29 '21 at 06:50