I pushed my files to git but the files within a subdirectory were not added. The folder appears blue with an arrow on it like so:
And when you click on that folder nothing happens.
I followed the instructions on this website:
[how to add subdirectories in github][2]
I cd into the directory that is not up to date on git. I ran
git init -b master
I then ran
git add new-folder/
but that yielded the error:
fatal: pathspec 'latin/' did not match any files.
I then guessed and ran
git add . && git commit -m 'a'
That yielded
[master (root-commit) c94b921] a
511 files changed, 6344433 insertions( )
I then ran
git push -u origin master
And got:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Not really understanding the meaning of the -u flag I ran I then tried:
git push origin master
And got:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
I then guessed and backed up to directory above
cd ..
And ran
git push origin master
And got:
Everything up-to-date
I refreshed the page on the github repository and no changes were made.
#########UPDATE
People are telling me that I need to use submodule
. I just want to make sure that it's clear that I want only one repository. I have roughly 8 subdirectories and I find it very hard to believe that guthub's software would be so cumbersome that it cannot enable users to update changes to files in different subfolders with the click of one button. I want to set things up so that when I make changes in two different folders that changes from both folders are both updated when I hit git push
######### SECOND UPDATE
I deleted the .git
folder in the subdirectory whose name is latin
. I then ran
git add latin
git commit -m 'a'
git push -u origin master
which outputted:
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 240 bytes | 240.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:kylefoley76/latin_databases2.git
b617974..a549a34 master -> master
branch 'master' set up to track 'origin/master'.
I then refreshed the page in github and although it said that the latin
subdirectory was updated a minute ago, you still can't click on it and see the subfolders within in it.
CodePudding user response:
- Make sure that the names of these files are not written in the
.gitignore
file. - Display the name of your remote repository using this command:
git remote -v
-
git push name-of-your-repository master
CodePudding user response:
I decided to delete the repository and start over. I'm pretty sure that when I tried it before that I did not have a .git file in the subfolder but maybe I'm wrong. This time around I deleted all hidden .git files and uploaded everything from scratch. One of the instructions that I was getting wrong was
git add 'readme.md'
Github really should alter that instruction because I assumed that since I didn't have a 'readme.md' file I didn't need to run it but by running
git add .
That seemed to add the files that I needed to add in the subdirectories.