克隆回购的正确方法我贡献,postgres错误

时间:2013-11-07 15:46:58

标签: ruby-on-rails github pg

我是github上其他人的存储库的贡献者。我希望项目在我的新机器上运行

我用以下方式拉了项目:

git clone https://github.com/thebenedict/cowsnhills.git

然后运行bundle并且它都是肉汁,但是当我启动服务器时我得到了错误

PG::ConnectionBad
FATAL: password authentication failed for user "cnh" FATAL: password authentication failed for user "cnh"

我的pg gem似乎安装得很好。我使用sudo apt-get install libpq-dev并没有出错。

如果我git pull origin master它给了我适当的“已经最新”

它从未向我询问过我的github登录凭据。我该怎么做才能运行服务器?

修改

好的我需要在本地机器上设置postgres数据库,config/database.yml文件如下所示:

development:
  adapter: postgresql
  encoding: unicode
  host: localhost
  database: cnh_development
  pool: 5
  username: cnh
  password: cnh

在终端我尝试过:

$ sudo -u postgres psql
psql (9.1.10)
Type "help" for help.

postgres=# create role cnh with createdb login cnh password 'cnh'
postgres-# \q

$ rake db:setup
FATAL:  password authentication failed for user "cnh"
FATAL:  password authentication failed for user "cnh"

在给定上述配置文件的情况下,我需要运行什么postgres命令来设置我的数据库?

1 个答案:

答案 0 :(得分:2)

好的,我真的很开心。我必须创建一个pg用户,创建数据库并通过

更新用户的角色
$ sudo -u postgres psql
CREATE USER cnh WITH password 'cnh';
ALTER USER cnh WITH SUPERUSER;
CREATE DATABASE cnh WITH OWNER cnh;
\q
$ sudo service postgresql restart
$ rake db:setup
相关问题