2

I have a folder with 2 files. how do I push the entire folder to bitbucket? My main objective is to have someone be able to download the entire folder.

In my terminal, I'm at the level where if I type ls, I can see the folder(named folder1) I want to commit.

git add folder1

git commit folder1

git push -u origin master

what I get is nothing (my bitbucket says No files in directory). I tried

git push -f origin master

and no luck

semidevil
  • 57
  • 7
  • update, okay I tried again bitbucket is still empty, but it does say it wrote 2 objects, which I think to mean it did it...but why can't I see it? – semidevil Apr 15 '20 at 19:33
  • Is your folder empty? Git tracks only files. If that is the case, [this thread](https://stackoverflow.com/q/115983/5987698) might be useful. – GoodDeeds Apr 15 '20 at 22:22
  • I have 2 files that I want to commit, and since these 2 files are inside the folder, I want to commit the entire folder. do I need to be inside the folder1 and track everything inside first, and then go up one level and commit? – semidevil Apr 15 '20 at 23:12
  • No, that should not be necessary. Are you sure those files are not set to be ignored by git, using a .gitignore file? What is the output of `git status`? – GoodDeeds Apr 15 '20 at 23:18
  • they are just 2 .py files. output of git status is that branch is up to date and nothing to commit. – semidevil Apr 15 '20 at 23:34
  • What’s the output of `git status --ignored`? – evolutionxbox Apr 16 '20 at 00:10
  • Also update the output of `git log` and `git show HEAD` – CodeTalker Apr 16 '20 at 04:48

1 Answers1

1

First, make sure that folder does not have a .git subfolder in it.
You would be adding/committing a nested repository, which would result in an empty folder on the remote side.

Second, make sure those files are not ignored with:

git check-ignore -v -- folder/aFile
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283