I upload my Laravel project to GitHub but unfortunately the .env file didn't uploaded. how we can upload it with my project?

huangapple go评论55阅读模式
英文:

I upload my Laravel project to GitHub but unfortunately the .env file didn't uploaded. how we can upload it with my project?

问题

最近我使用GitHub将我的项目上传到了上面。但是当我的另一个朋友想要与我的项目同步时,他找不到.env文件。我现在该怎么办?

英文:

recently I used the GitHub to uppload my project on it. but when another my friend want to sync with my project he can't find the .env file

how should I do now?

答案1

得分: 3

如Shiva所回答,该文件被Git忽略,因为它在你的.gitignore文件中提到。只要你了解安全风险,你可以从文件中删除它,这样就可以上传它了。一个更好的选择是将其加密。自从Laravel v9.23以来,你可以使用Artisan使用env:encrypt加密你的.env文件,并使用env:decrypt解密。

未加密的环境文件绝不应存储在源代码控制中。然而,Laravel允许你加密你的环境文件,以便它们可以安全地与应用程序的其余部分一起添加到源代码控制中。

参见:https://laravel.com/docs/10.x/configuration#encryption

英文:

As Shiva answered, the file is ignored by git because it's mentioned in your .gitignore file. You could remove it from the file so you can upload it as long as you are aware of the security implications. A better option would be to encrypt it. Since Laravel v9.23 you can encrypt your .env file with Artisan using env:encrypt and decrypt with env:decrypt

> Unencrypted environment files should never be stored in source control. However, Laravel allows you to encrypt your environment files so that they may safely be added to source control with the rest of your application.

See: https://laravel.com/docs/10.x/configuration#encryption

答案2

得分: 1

检查你的.gitignore文件。
我认为这个文件包含在.gitignore文件中,以便它不会被包括并上传到GitHub。
由于.env文件包含了项目特定的秘密和配置,它不应该暴露给其他人。
然而,如果你仍然想上传它,可以在.gitignore文件中移除它的条目。这可能会解决你的问题。

英文:

Check your .gitignore file.
I think this is included in .gitignore file so that it is not included and not uploaded to github.
Since, .env file includes your project specific secrets and configurations, it shouldnot be exposed to others.
However, If you want to upload it anyway, remove its entry on .gitignore file. This may resolve your issue.

huangapple
  • 本文由 发表于 2023年3月8日 17:19:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75671251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定