I'm following along "Rebuilding Rails" and I'm trying to push the rulers/ folder to github but I can't seem to add the folder? I have a repo setup and can push some files but not the rulers/ folder.
I've tried
git add .
git add *
git add ruler
I've tried pulling, merging, and a few other.
my .gitignore contains:
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
If I cd into the folder I get:
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'github.com:*******/railZ.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
On branch main
Your branch is up to date with 'origin/main'.
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: rulers (untracked content)
no changes added to commit (use "git add" and/or "git commit -a")
CodePudding user response:
You can't commit empty folders in Git. If you want this folder to exist in the repo, you have to put a file in it.
By convention, you could use an empty file named .gitkeep
, but any file will do.
CodePudding user response:
Check first if the rules folder is:
- a nested Git repository (there would be a
rulers/.git
subfolder) - a submodule (the parent repository would have a .gitmodules listing it)
I mention that possibility, because of repositories like noahgibbs/rulers
, which represent the rulers
folder/repository.
In both cases, pushing the parent repository would result in an "empty" rulers folder (actually a placeholder, for another repository)