简体   繁体   English

config / routes.rb和config / database.yml权限问题

[英]config/routes.rb and config/database.yml permission issues

I'm working with ruby on rails through terminal on a mac. 我正在通过Mac上的终端在Rails上使用ruby。 Every time I try to gain access to these, including every file I've created through the ruby on rails guide I keep seeing 每次我尝试访问这些文件时,包括我不断看到的通过ruby on rails指南创建的每个文件

Stephen-Troschs-MacBook-Pro:blog stephentrosch$ config/routes.rb " Stephen-Troschs-MacBook-Pro:blog stephentrosch$ config/routes.rb

-bash: config/routes.rb: Permission denied'

Stephen-Troschs-MacBook-Pro:myapp stephentrosch$ app/views/home/index.html.erb

-bash: app/views/home/index.html.erb: Permission denied'

How would I gain the correct permissions? 我如何获得正确的权限?

When you enter a filename by itself as a command, the OS attempts to execute it (run it as a program). 当您单独输入文件名作为命令时,操作系统会尝试执行该文件名(将其作为程序运行)。

Those files are not meant to be executable (and wouldn't do anything if you did try to execute them), so they don't have that permission set. 这些文件不是可执行文件(如果您尝试执行它们,则不会执行任何操作),因此它们没有设置该权限。

You probably want to read them, for example by opening them in a text editor: 您可能想阅读它们,例如通过在文本编辑器中打开它们:

$ vi config.yml

You should use the text editor of your choice to open those files. 您应该使用所选的文本编辑器打开这些文件。 Like vi config/routes.rb or any other editor as per your preference. vi config/routes.rb或您喜欢的任何其他编辑器。 You can also use any editors likes sublime, aptana which gives better flexibility to write code for beginners. 您还可以使用诸如sublime,aptana之类的任何编辑器,它为初学者编写代码提供了更好的灵活性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM