2

I am trying to push two folders to a repo on Bitbucket but when I commit I get the following (I did add and commit previously):

 2 files changed, 2 insertions(+)
 create mode 160000 folder2
 create mode 160000 folder1

What is that code before folder 2 and 1? Why is it that the files contained in the folder are not being pushed, only the folder names itself?

konyv12
  • 716
  • 2
  • 8
  • 23
  • 1
    Did you *add* and *commit* the files in those folders? You push commits, not files, so unless you added and committed them locally first, git doesn't track them. – Lasse V. Karlsen Mar 07 '17 at 08:57
  • The modes listed are unix file/folder attributes, which git tracks, even though you're on different operating systems. Usually you can ignore those bits. – Lasse V. Karlsen Mar 07 '17 at 08:58
  • Yes, I added both "git add ." and "git commit -m "comment"" – konyv12 Mar 07 '17 at 09:13

1 Answers1

2

Notice the 160000 mode [...]. That is a special mode in Git that basically means you’re recording a commit as a directory entry rather than a subdirectory or a file.

From Git Tools - Submodules. It looks like you added submodules in those folders.

Git does not track folders, it just tracks files and their locations. Folders are stored implicity; if a file exists in a /source folder, there has to be folder named source (See this answer).

What exactly were your steps to get into this state?

Community
  • 1
  • 1
kowsky
  • 12,647
  • 2
  • 28
  • 41
  • git init, git add ., git commit -m "comment" – konyv12 Mar 07 '17 at 11:32
  • Are there other repositories in those folders? I could reconstruct your situation when the folders contain git repositories themselves. In this case, git creates a gitlink to those repositories instead of adding the contents (files) of the other repository. – kowsky Mar 07 '17 at 11:46
  • I found [this answer](http://stackoverflow.com/a/5981099/7598462) that describes details about nested repositories and seems to fit to your problem. – kowsky Mar 07 '17 at 11:48
  • thanks so much it worked – konyv12 Mar 07 '17 at 12:32