[英]Storage link is not included when doing a Git push Laravel
I just have done a git push
in our online repo我刚刚在我们的在线仓库中做了一个
git push
When I checked the online repo and checked the public
folder it shows this:当我检查在线存储库并检查
public
文件夹时,它显示了以下内容:
while in my local repo I have this in my public
folder:在我的本地仓库中,我的
public
文件夹中有这个:
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.我猜这与我本地
public
文件夹中的.gitignore
。 It contains:它包含了:
*
!.gitignore
Same goes with my storage folders.我的存储文件夹也是如此。 In our Online repo inside
storage/app/public
:在我们的在线
storage/app/public
:
while in my local storage
folder:在我的本地
storage
文件夹中:
user_images
is present in my local repo. user_images
存在于我的本地存储库中。 Here is the inner .gitignore
:这是内部
.gitignore
:
*
!.gitignore
and the outer .gitigore
:和外部
.gitigore
:
*
!public/
!.gitignore
I am not quite familiar with setting rules in .gitignore
.我不太熟悉
.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
:这是根
.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
我已经删除了
.gitignored
/public/storage
并尝试执行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
尝试运行
git check-ignore -v path/to/file
In my root .gitignore
:在我的根
.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
.如果我运行
git check-ignore -v public/hot
,它会回复.gitignore:2:/public/hot public/hot
但如果我运行git check-ignore -v public/storage
,它不会响应任何它应该是因为它包含在 root .gitignore
我开始相信这种情况使得public/storage/user_images
和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
.但我可以确认 @VonC 方法帮助我在
gitignore
进行了适当的排除。 Thanks.谢谢。
EDIT:编辑:
Final gitignores so far到目前为止的最终 gitignores
root .gitignore
:根
.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存储\\应用程序.gitignore
# *
# !public/
!.gitignore
storage\\app\\public.gitignore存储\\应用程序\\public.gitignore
# *
!.gitignore
public\\storage.gitignore公共\\storage.gitignore
# *
!.gitignore
Just an additional info:只是一个额外的信息:
git check-ignore -v vendor
gives .gitignore:5:/vendor vendor
git check-ignore -v vendor
给出.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
而
git check-ignore -v /vendor
给出了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.我不确定
git check-ignore -v
path 指向哪里。
First, for any file ignore within a folder, type:首先,对于文件夹中的任何文件ignore,键入:
git check-ignore -v -- path/to/file
That will display exactly which .gitignore
is responsible for ignoring said file.这将准确显示哪个
.gitignore
负责忽略所述文件。
Second, the rule of gitignore is simple:二、gitignore的规则很简单:
It is not possible to re-include a file if a parent directory of that file is excluded.如果排除了该文件的父目录,则无法重新包含该文件。
To exclude files (or all files) from a subfolder of an ignored folder f
, you would do:要从被忽略文件夹
f
的子文件夹中排除文件(或所有文件),您可以执行以下操作:
f/**
!f/**/
!f/a/sub/folder/someFile.txt
Meaning: you need to whitelist folders first, before being able to exclude from gitignore files .含义:您需要先将文件夹列入白名单,然后才能从 gitignore文件中排除。
对于那些可能仍在寻找答案的人,请编辑 storage/app 和 storage/app/public 文件夹中的 .gitignore 文件,并从每个文件夹中删除前 2 行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.