Projeto: Vermelho

logs of development
スポンサーサイト

一定期間更新がないため広告を表示しています

| - | | - | -
herokuでdeployしたときに"Your key with fingerprint xxxxxxxxxxxx is not authorized to access appname."と言われたら
http://quattrooooo.cocolog-nifty.com/blog/2012/03/herokugit-clone.html

以下、herokuの2つのアカウントを仮にjimmyとjackとする

$ heroku plugins:install git://github.com/ddollar/heroku-accounts.git
heroku-accounts installed
$ heroku accounts
No accounts found.
$ heroku accounts:add jimmy
Enter your Heroku credentials.
Email: jimmy@xxxxx.xxxxx
Password:

Add the following to your ~/.ssh/config

Host heroku.jimmy
HostName heroku.com
IdentityFile /PATH/TO/PRIVATE/KEY
IdentitiesOnly yes
$ heroku accounts:add jack
Enter your Heroku credentials.
Email: jack@*****.*****
Password:

Add the following to your ~/.ssh/config

Host heroku.jack
HostName heroku.com
IdentityFile /PATH/TO/PRIVATE/KEY
IdentitiesOnly yes

次に、sshのkeyを作成してIdentityFile の /PATH/TO/PRIVATE/KEY にPATHを記載する

◇sshのkey
keyを1つは紛失し、1つは複数アカウントの試行錯誤中に削除したため、最初から作成しなおし。

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/jimmy/.ssh/id_rsa): /Users/jimmy/.ssh/id_rsa_jimmy
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/jimmy/.ssh/id_rsa_jimmy.
Your public key has been saved in /Users/jimmy/.ssh/id_rsa_jimmy.pub.
The key fingerprint is:
79:cd:45:ee:37:da:18:66:3f:c5:6e:53:c6:44:f5:a3 jimmy@xxxxxxxxxx
The key's randomart image is:
+--[ RSA 2048]----+
| ..+|
| . +.|
| . o.+.o|
| + + ..+=o.|
| + S o .= ..|
| + + E |
| . |
| |
| |
+-----------------+
$

jackに対しても同様に
$ ssh-keygen -t rsa
して
/Users/jimmy/.ssh/id_rsa_jack
を作成
上記のheroku accounts:add実行時のコメントに従い、~/.ssh/config を以下のように編集

Host heroku.jimmy
HostName heroku.com
IdentityFile /Users/jimmy/.ssh/id_rsa_jimmy
IdentitiesOnly yes

Host heroku.jack
HostName heroku.com
IdentityFile /users/jimmy/.ssh/id_rsa_jack
IdentitiesOnly yes

◇git clone

$ heroku accounts:default jimmy
$ git config heroku.account
jimmy
$ heroku accounts
* jimmy
jack

で、適当なディレクトリを作成してそこでgit cloneすると

$ git clone git@heroku.com:myapp_jimmy.git .
Cloning into ....

! Your key with fingerprint 79:cd:45:ee:37:da:18:66:3f:c5:6e:53:c6:44:f5:a3 is not authorized to access myapp_jimmy.

fatal: The remote end hung up unexpectedly

heroku keys:addが必要

$ heroku keys
No keys for jimmy@xxxxx.xxxxx
$ heroku keys:add
Found the following SSH public keys:
1) id_rsa_jimmy.pub
2) id_rsa_jack.pub
Which would you like to use with your Heroku account? 1
Uploading SSH public key /Users/jimmy/.ssh/id_rsa_jimmy.pub

再度git clone

$ git clone git@heroku.com:myapp_jimmy.git . Cloning into .... Permission denied (publickey). fatal: The remote end hung up unexpectedly $

googleさんで調べるとssh-addが必要とのことで

$ ssh-add -l
The agent has no identities.
$ ssh-add ~/.ssh/id_rsa_jimmy
Enter passphrase for /Users/jimmy/.ssh/id_rsa_jimmy: 
Bad passphrase, try again for /Users/jimmy/.ssh/id_rsa_jimmy: 

ssh-agenetが必要らしい

$ ps ax | grep ssh-agent
536 ?? S 0:00.07 /usr/bin/ssh-agent -l
739 s000 R+ 0:00.00 grep ssh-agent
$ eval 'ssh-agent'
SSH_AUTH_SOCK=/tmp/ssh-CpJmPKiFmG/agent.740; export SSH_AUTH_SOCK;
SSH_AGENT_PID=741; export SSH_AGENT_PID;
echo Agent pid 741;
$ ps ax | grep ssh-agent
536 ?? S 0:00.07 /usr/bin/ssh-agent -l
741 ?? Ss 0:00.03 ssh-agent
743 s000 R+ 0:00.00 grep ssh-agent
$ ssh-add ~/.ssh/id_rsa_jimmy
Enter passphrase for /Users/jimmy/.ssh/id_rsa_jimmy: 
Identity added: /Users/jimmy/.ssh/id_rsa_jimmy (/Users/jimmy/.ssh/id_rsa_jimmy)



複数アカウントを使う場合には
http://journal.sooey.com/162

続きを読む >>
| Heroku | 01:14 | comments(0) | trackbacks(0)
HerokuでRuby1.9.3 + Rails3.2.0を使う
 http://railsapps.github.com/rails-heroku-tutorial.html

accountを使い分ける

http://journal.sooey.com/162
| Heroku | 15:42 | comments(0) | trackbacks(0)
Heroku + Amazon S3
http://wine4u.seesaa.net/article/170193214.html

Gemfileに以下を追加
gem 'paperclip'
gem 'aws-s3'

config/s3.ymlを作成

development:
  bucket: myappdevelopment
  access_key_id: your key
  secret_access_key: your key

test:
  bucket: myapptest
  access_key_id: your key
  secret_access_key: your key

production:
  bucket: mosolab
  access_key_id: KEY_ID
  secret_access_key: ACCESS_KEY

画像を関連させるモデルに以下を追加

  #http://rdoc.info/github/thoughtbot/paperclip
  has_attached_file :photo, Proc.new {
    if RAILS_ENV == 'production'
      {
        :styles => {:thumb => "50x50", :medium => "100x100", :large => "500x500"},
        :storage => :s3,
        :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
        :path => ":attachment/profiles/:id/:style.:extension",
        :url => ":s3_domain_url",
        :bucket => 'mosolab'
      }
    else
      {
        :styles => {:thumb => "50x50", :medium => "100x100", :large => "500x500"},
        :url => "/images/MODELs/:id/p_:style.:basename.:extension",
        :path => ":rails_root/public/images/MODELs/:id/p_:style.:basename.:extension"
      }
    end
  }.call

Viewを書き換え
<%= form_for @MODEL , :html => { :multipart => true } do |f| %>
(form内に追記)
<%= f.file_field :photo %>
| Heroku | 01:03 | comments(0) | trackbacks(0)
PROFILE
CATEGORIES
LINKS
CALENDAR
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28293031   
<< May 2017 >>
SELECTED ENTRIES
ARCHIVES
モバイル
qrcode
SPONSORED LINKS