Reputation: 105
I have a directory,spring-boot-test, that I need to upload to github. The directory has child directories and files within them.
drwxrwxr-x. 23 jenkinsadmin jenkinsadmin 4096 Sep 19 02:33 spring-boot-test
When I push the directory, it shows it as a file in github or it shows there are no child directories under it.
git add .
git push origin master
Another try per comment:
[jenkinsadmin@localhost test]$ git add --all
[jenkinsadmin@localhost test]$ git commit -m "test"
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: spring-boot-test (modified content)
no changes added to commit
[jenkinsadmin@localhost test]$ git push
Everything up-to-date
and I get Everything up-to-date
, but if I check in github, it has folder symbol but contains nothing.
I do not want to drag and drop using GUI. I am using git command on Linux.
Upvotes: 3
Views: 5217
Reputation: 500
on the github when i see the contents of the folder it is empty but when i clone it has the data, this is a little annoying to me, I've tried removing .git folder but still no luck, or the arch is built like that.
here is my git repo : https://github.com/adithnaveen/SapientTraining2019Batch/tree/master/whelps%20code
Upvotes: 0
Reputation: 1146
You need to commit changes before pushing it to the remote repo:
git add .
git commit -m "Your commit"
git push <remote> <branch-name>
e.g. git push origin master
Upvotes: 0
Reputation: 1323343
When I push the directory, it shows it as a file in github or it shows there are no child directories under it.
That means it shows a gitlink: a SHA1 reference to the root tree SHA1 of a subrepo.
First remove it from your index:
git rm --cached spring-boot-test
(no trailing /
: you are removing a file-ish entry)
Then remove its .git
subfolder (if you don't care about the history) of those files, then add, commit and push.
The alternative would be to reference spring-boot-test
as a submodule. It would then show up on GitHub as a "file", but this time, cloning your repo would bring spring-boot-test
content with it.
Upvotes: 4
Reputation: 105
Thanks for the all the suggestions here. The local folder appeared to have hidden github files (.github). I removed any hidden files related to git and github. I can see all the sub folders and files are populated in github now.
Upvotes: 0
Reputation: 37217
You need to commit the files before trying to push them:
git add --all
git commit -m "message"
git push
Upvotes: 2