I just have done a git push
in our online repo
When I checked the online repo and checked the public
folder it shows this:
while in my local repo I have this in my public
folder:
My local has Storage folder from my storage link. I am guessing that this has something to do with the .gitignore
inside my local public
folder. It contains:
*
!.gitignore
Same goes with my storage folders. In our Online repo inside storage/app/public
:
while in my local storage
folder:
user_images
is present in my local repo. Here is the inner .gitignore
:
*
!.gitignore
and the outer .gitigore
:
*
!public/
!.gitignore
I am not quite familiar with setting rules in .gitignore
. I wish to make sure that whatever my local Storage and public folder has, the Online repo has as well. How should I go about in doing this?
Kindly edit my tags if it is misleading or incorrect. Thank you.
This is the content of the root .gitignore
:
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
I have removed /public/storage
in .gitignored
and tried to do a git push
Changes not staged for commit:
modified: .gitignore
and still, nothing is the same from my local to Online repo? Anything I might have missed?
Tried running git check-ignore -v path/to/file
In my root .gitignore
:
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
If I ran git check-ignore -v public/hot
, it replies with .gitignore:2:/public/hot public/hot
but if I ran git check-ignore -v public/storage
, it doesn't respond with anything which it should because it is included in root .gitignore
I come to believe that this situation made it impossible for the public/storage/user_images
and storage/app/public/user_images
. Any help is needed.
I may have been viewing a wrong file or path all this time. But I can confirm that @VonC method helped me do a proper exclusion in gitignore
. Thanks.
EDIT:
Final gitignores so far
root .gitignore
:
/node_modules
# /public/hot
# /public/storage
/storage/*.key
/vendor
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
storage\app.gitignore
# *
# !public/
!.gitignore
storage\app\public.gitignore
# *
!.gitignore
public\storage.gitignore
# *
!.gitignore
Just an additional info:
git check-ignore -v vendor
gives .gitignore:5:/vendor vendor
while git check-ignore -v /vendor
gives fatal: C:/Program Files/Git/vendor: 'C:/Program Files/Git/vendor' is outside repository
I'm not sure where git check-ignore -v
path points to.
noimage.jpg
will be used as default. What are your suggestions? – Hoylenoimage.jpg
as an exemption? or if not at least everything else in my local reflects exactly to the online repo? – Hoyle.gitignore
in my post. I hope it helps. – Hoyle/public/storage
in .gitignore and hence the storage folder is ignored in the push :) – Helsa/storage/*.key
to reflect all my local folders in storage to online storage folder? Or the/public/storage
is enough to solve bothpublic
andstorage
folder synching? – Hoyleimg src
path to mess up? Is there a way to exclude storage folder altogether? – Hoylepublic/storage
entry from gitignore and push the changes. It will automatically show you to add the storage folder it will show in red as untracked. – Helsanoimage.jpg
– HoyleChanges not staged for commit: modified: .gitignore
– Hoylegit add .gitignore public/storage
andgit push
– Helsagit push
it saidEverything up-to-date
and when i did agit status
it saysChanges to be committed: modified: .gitignore
in green color. – Hoylegit add .gitignore public/storage
,git commit -m "test"
,git push
and checked online repo but it still has nopublic\storage\user_images
andstorage\app\public\user_images
where am I doing it wrong? – Hoyle