git 推送到 Heroku 不会使用 .git 忽略创建目录
git push to Heroku does not create directory with .gitignore
所以在我的主人中,我在我的 repo 的根目录中添加了一个名为 log/
的新目录,其中包含一个 .gitignore
文件,其中包含一行 *.log
当我检查 bitbucket 时,所有内容都已正确推送,浏览源时目录存在。
然而,当我做 git push heroku master
我已经完成的所有其他提交时 before/after 似乎已经应用了该目录的添加..但是 log/ 目录无处可去看到了!知道这有什么奇怪的吗??
PS。 运行 将回购检出到一个空文件夹中会正确创建文件夹,所以这肯定是一个 heroku 问题,对吗?
您不需要在 heroku 上创建日志目录。正如您所发现的,heroku 甚至不会在您的存储库的根目录中创建日志目录。为了在 Heroku 上查看您的日志,它们应该直接打印到 STDOUT 或 STDERR,然后由 Logplex 处理。请参阅 Heroku documentation for more information on logging. That document, however, doesn't mention that the log directory in a repository won't ever make it to heroku. The document on the slug compiler 确实声明它将执行以下操作:
Remove unused files, including .git directories, .gitmodules files,
anything in log and tmp, and anything specified in a top-level
.slugignore file.
由于这是预接收挂钩的一部分,因此 Heroku 上的 git 存储库从未看到任何对 /log
中文件的引用,因此永远不会创建该目录。
更新 Django 日志记录配置以使用控制台处理程序而不是文件处理程序,以便日志将转到 STDERR。
所以在我的主人中,我在我的 repo 的根目录中添加了一个名为 log/
的新目录,其中包含一个 .gitignore
文件,其中包含一行 *.log
当我检查 bitbucket 时,所有内容都已正确推送,浏览源时目录存在。
然而,当我做 git push heroku master
我已经完成的所有其他提交时 before/after 似乎已经应用了该目录的添加..但是 log/ 目录无处可去看到了!知道这有什么奇怪的吗??
PS。 运行 将回购检出到一个空文件夹中会正确创建文件夹,所以这肯定是一个 heroku 问题,对吗?
您不需要在 heroku 上创建日志目录。正如您所发现的,heroku 甚至不会在您的存储库的根目录中创建日志目录。为了在 Heroku 上查看您的日志,它们应该直接打印到 STDOUT 或 STDERR,然后由 Logplex 处理。请参阅 Heroku documentation for more information on logging. That document, however, doesn't mention that the log directory in a repository won't ever make it to heroku. The document on the slug compiler 确实声明它将执行以下操作:
Remove unused files, including .git directories, .gitmodules files, anything in log and tmp, and anything specified in a top-level .slugignore file.
由于这是预接收挂钩的一部分,因此 Heroku 上的 git 存储库从未看到任何对 /log
中文件的引用,因此永远不会创建该目录。
更新 Django 日志记录配置以使用控制台处理程序而不是文件处理程序,以便日志将转到 STDERR。