Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

extjac's avatar

DevOps - GitHub Actions & AWS

I know this is not a Laravel question but....I am trying to deploy Laravel app using github actions; but i am geeting the following error message on the deploy.sh file.

err: fatal: could not read Username for 'https://github.com': No such device or address

My deploy.sh looks like this...

#./deploy.sh
set -e

echo 'Deploying....'

#sudo php artisan down --message "App is being updated....please try again in a few min"

sudo git pull https://github.com/MyUserName/MyRepo.git

sudo php artisan migrate --force
sudo php artisan queue:restart
sudo php artisan optimize
#sudo php artisan up

echo 'Deploying completed!'

my Laravel.yml looks like this

#./github/workflows/laravel.yml

name: Push-to-AWS

on:
  push:
    branches: [ master ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        token: ${{ secrets.PUSH_TOKEN }}
    - name: 🔎 Check IP
      run: curl https://api.ipify.org

    - name: Deploy to Server 1
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.HOST_DNS }}
        username: ${{ secrets.USERNAME }}
        key: ${{ secrets.SSH_KEY }}
        port: ${{ secrets.PORT }}
        script: 'cd /path_to_app && sudo chmod +x deploy.sh && ./deploy.sh'          
0 likes
5 replies
OussamaMater's avatar

This might help you

Otherwise why not setup your ssh keys and you should avoid all kind of issues (cause if it's a private repository or you decide later on to change it to private, that script will fail) I am sure Github stopped using passwords long ago, for security reasons.

1 like
extjac's avatar

@OussamaMater sorry, i am not sure what you mean by setting up SSH keys. I already setup them and using them on the yml file. Also using github token.

OussamaMater's avatar

@extjac No I mean setup SSH keys for the connection and repo authorization, so you use git@github:<username>/<repo> instead of https which most likely causing the error when pulling.

Here is a tutorial:

This will probably solve the issue.

Edit: your yml file is working as expected the error is in your deploy.sh when pulling the repo using https.

2 likes

Please or to participate in this conversation.