2

My blog is built with hexo, which will be pushed to blog repo in github

blog/

--themes/

----pacman/

But there is a sub forder pacman. It was cloned from other repo in github, meaning it has its own .git folder.

When I try to commit and push the whole directory to blog repo, the contents of pacman are NOT pushed to github

I try to delete .git in pacman but it could NOT be pushed to github either.

Here is the git status after deleting the .git in pacman

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

nothing to commit, working directory clean

Here is the .gitignore, it has nothing to do with the pacman as far as I could see

.DS_Store
Thumbs.db
db.json
debug.log
node_modules/
public/
.deploy/

When I push to blog repo, I'd like to push everything under pacman as well. How can I do that?

macemers
  • 2,194
  • 6
  • 38
  • 55
  • What is your `git status` output? what command did you try and with what results? Do you have a `.gitignore` file, and what is inside it? – fpietka Aug 06 '14 at 05:24
  • I use `git add .` and `git commit -m ""` and `git push origin master` to push. Please see the update – macemers Aug 06 '14 at 05:28
  • If your GitHub repo is public, please provide a link to it. – Nick McCurdy Aug 06 '14 at 05:33
  • 1
    @NicolasMcCurdy `blog` repo: https://github.com/DerekYangYC/blog – macemers Aug 06 '14 at 05:41
  • What are the dashes in your subfolders names? I don't see them in `themes` subfolder. It looks like pacam folder isn't located in your blog/ folder. – fpietka Aug 06 '14 at 05:49
  • @fpietka sorry, it's `pacman`, you could find the folder in https://github.com/DerekYangYC/blog/tree/master/themes – macemers Aug 06 '14 at 05:54

1 Answers1

3

Looks like you have submodules (hexo-theme and pacman), but no .gitmodules file.

Here is what I get from deleting those empty folders:

diff --git a/themes/hexo-theme b/themes/hexo-theme
deleted file mode 160000
index 994a837..0000000
--- a/themes/hexo-theme
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 994a83762b8ef83d7516c098f4ad5065f6886304
diff --git a/themes/pacman b/themes/pacman
deleted file mode 160000
index 8a9440c..0000000
--- a/themes/pacman
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 8a9440ca773dccf8ea30c3fc0cea342e0707b360

They are external submodule references.

What you can do from here, is removing those folders, commit the change, then copy (not using git here) them back again (without the .git). Then you should be able to add and commit them into your repository.

You could also stick with submodules, so you will be able to keep them updated.

fpietka
  • 1,027
  • 1
  • 10
  • 23
  • thx, it works. one further question: could I keep the `.git` folder in `pacman` and commit to `blog` repo? – macemers Aug 06 '14 at 06:39
  • It is probably a bad idea. This folder is only needed to work on that particular repository. If that is indeed what you want, again please consider using submodules. – fpietka Aug 06 '14 at 06:46
  • I don't want to use submodules. How can I add a .git from a subfolder, as the question asked? – Seph Reed Jul 18 '19 at 03:24
  • If you insist, just add it as any other folder. Then you won't be able to have any understandable history of they are internal git files, and it is not intended to be used like that. You'll have to take responsibility for this choice as probably no one will be able to help you from that point. You are supposed to use either submodules or subtrees to handle extra repository. – fpietka Jul 25 '19 at 11:30