'git add .' failing to stage files in OS X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm having a problem on my MacBook.  When I do `git add .` and then do
`git status`, all my files in the current directory and subdirectory
remain untracked.  I'm not sure if it's a bug in the OS X version of
git I'm using (I tried upgrading) or something specific to the setup
on my Mac (I've tried eliminating possibilities).

The problem started with a directory I had named 'micronaut-guides'
that I wanted to initialize as a repo.  It had a subdirectory called
apprentice and one called data-access.  apprentice has a subfolder
named 'java' with five or six subfolders containing java projects, and
data-access had one folder 'jpa' containing a java application.  If I
cd to micronaut-guides, then `git init`, then `git add .` and then
`git status`, I get the following:

-----------------
On branch master

Initial commit

Untracked files:
    .gitignore
    README.md
    apprentice/
    data-access/

nothing added to commit but untracked files present
-----------------

If I try to track a specific file in a subdirectory (`git add
apprentice/java/commit-info/Dockerfile`), it successfully stages the
single file, and then lists other files in the
apprentice/java/commit-info directory as specifically untracked,
rather than just listing the directory as untracked.  I can
successfully stage a single file in the root directory of the
repository by doing `git add .gitignore`, and then when I do `git
status` the .gitignore file shows as staged and the other files remain
untracked.

I've since verified the command-line client is exhibiting the same
behavior in other repos cloned from github when I try to add content.
I cloned my spring-guides repository from github and created a
directory for the actuator-service guide, worked through the tutorial
to create a functioning project in the subdirectory, then did `git add
.` and `git status` and it said the new folder was untracked still.

I've found a work around.  Instead of using the command-line client, I
have to open the Github Desktop client, and then add my files and sync
to get changes up to my repo.  Everything works fine adding files and
pushing changes there.

So far, I've tried adding files in both a new and existing repository.
I've tried `git add -A` instead of  `git add .`.  I've tried `git add
--all ./` with no luck.  It has been doing the same thing for both the
Apple version of git I started with, and the 2.20.1 version that I
upgraded to (installed via homebrew).  I've also tried deleting my
.gitignore file, even though the same .gitignore works with repos on
Windows fine.  I made sure there was no .gitignore in any parent
directories and that there were no .git folders in any parent
directories.  `git check-ignore -v -- /path/to/a/file` didn't produce
any output.  I've also tried changing my shell to bash instead of zsh,
in case something in my shell was interfering.  I've checked my
aliases to make sure I'm not aliasing git to some other command.  And
I've tried moving the repo directory to / and adding files there, to
be extra sure nothing in any parent directory was interfering with the
operation.

As I recall, git used to work fine on this Mac, but it's been a while
since I've tried to use it (it being both the Mac and git on the Mac).
The Mac in question was recently upgraded to OS X Mojave (it bugged me
to upgrade when I dusted it off and turned it on).  I don't remember
when the last time I used git on it for anything before the upgrade
was..

I've asked about this in StackOverflow, so there are a little bit more
details and ideas from other people at
https://stackoverflow.com/questions/54175235/cant-git-add-to-stage-files-in-new-repo,
but I tried to summarize everything here.

Any ideas to fix this or even work around this without using a GUI
client would be appreciated.

Thanks,

Lewis Cawthorne



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux