Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

missing folder in repository after git add

Tags:

git

I'm using folder containing Software Development Kit (SDK), and tried to back it up with git into another folder in my laptop which I use as a git remote. I used git add *. It seemed that all worked well, I received no error or warning. So then i cloned the remote into another folder, and tried to compile, but got an error saying that files are missing. It turned out that a folder is missing in git.

Any idea what I did wrong ?

cd /home/ubuntu/backup
mkdir yamit
cd yamit
git init
git add *
git commit -m "first backup"
git remote add yamit /home/ubuntu/backup/yamit.git
git push -u yamit master
like image 659
ransh Avatar asked Jun 26 '14 05:06

ransh


2 Answers

Whenever you have a missing resource after a git add, you can easily check if it is part of any .gitignore with a git check-ignore (git 1.8.4+):

git check-ignore -v path/to/missing/ressource

Simply modify the .gitignore by removing its line ignore the resource you need.

Then add and commit again.

If you don't want to modify the .gitignore file, then a

git add -f .
# or
git add -f path/to/missing/*

That can force those ignored resources to be added to the index anyway.

like image 104
VonC Avatar answered Sep 29 '22 03:09

VonC


Ok. I've resolved this. Just needed to call add with force into repository.

git add * -f

Yet, I still don't unedrstand why Git decided to ignore the folder when trying without forcing ( it's non empty folder).

Thanks. Ran

like image 25
ransh Avatar answered Sep 29 '22 05:09

ransh