1

I've configured github repository in codeship already under Repository and add branch under Deployment. And

BRANCH_NAME="${CI_BRANCH}"
ROOT_FOLDER="/home/ubuntu/code"
EC2_SERVER="blah@blah.compute.amazonaws.com"
fetch_branch="cd $ROOT_FOLDER && git fetch origin" && echo $fetch_branch
ssh $EC2_SERVER $fetch_branch
pull_branch="cd $ROOT_FOLDER && git checkout $BRANCH_NAME && git pull
origin $BRANCH_NAME" && echo $pull_branch
ssh $EC2_SERVER $pull_branch
ssh $EC2_SERVER "rsync -rvI $ROOT_FOLDER/ /home/ubuntu/www/code/"

but I've found following error by Codeship while deploying.

enter image description here

PPShein
  • 13,309
  • 42
  • 142
  • 227

1 Answers1

0

The known_host part is an "info" message: it informs you that your ~/.ssh/known_hosts now lists your remote aws instance.
This is not blocking.

But you need to add your ~/.ssh/id_rsa.pub public ssh key to the ~blah/.ssh/authorized_keys file of the remote server if you want to open an ssh session on it.

See "Amazon EC2 Key Pairs" or "SSH Connections to AWS CodeCommit", which both describe the same principle.


The "fatal: could not read Username for http..." means it needs to know which user is accessing the GitHub repo.

cd /path/to/aws/repo
git remote set-url origin https://{username}:{password}@github.com/{username}/project.git

That is not very secure, as your password is part of the url.
Best would be to use a credential manager to cache said password (as illustrated here).
Or to use an ssh url for that repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sorry, I've solved that error message and forgot to update error message of codeship. I've edited my question and please let me know how to solve it. Thanks. – PPShein Jan 13 '17 at 06:27