1

I want to be able to add everything that I edit in my octopress directory to github in case all the files die.

But I get this error:

➜  octopress git:(master) ✗ git add source/*
fatal: Pathspec 'source/about' is in submodule 'octopress'

How can I just make this octopress directory part of my overall git repository?

Satchel
  • 15,436
  • 22
  • 100
  • 180

1 Answers1

2

If a path is in a submodule, it would be part of the path declared in .gitmodules (at the root of the parent repo).
See "List submodules in a git repository"

git config --file=.gitmodules --get-regexp ^^submodule.*\.path$ | cut -d " " -f 2

You should be able to add files and push from that source/about submodule.

If you cannot push, that means the upstream repo of that submodule is not owned by you. You could also consider un-submodule-ing the submodule.


How do I change ownership?

If you are in a repo you cannot push to, go to GitHub to that GitHub repo page, and click the fork button.

Then go back to your local repo and type:

git remote set-url origin https://<username>@github.com/<username>/arepo.git

(replace <username> with your GitHub account name, and arepo.git by the name of the repo you just forked)

Then try a git push -u origin master.

If your repo includes submodules (has a .gitmodule file), the same principle would apply.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I don't want to push back to the octopress repository but have it all stored in my repo in case something happens and I need to restore. So o am guessing the sub module is still owned by the octopress repo. How do I change owner ship? – Satchel Nov 19 '15 at 04:22