1

I have stored my SSH password in the GitHub Secret. With the keyname PASSWORD. When I use it with ${{secrets.PASSWORD}} I get no output. And therefore no access to the server via SSH. What do I have to do to use my secret as password?

      - name: Run a multi-line script
        run: |
          echo Echo my secret
          echo ${{secrets.PASSWORD}}

      - name: executing remote ssh commands using password
        uses: appleboy/ssh-action@master
        with:
          host: '12234.myserver.com'
          username: 'ssh-user'          
          password: ${{secrets.PASSWORD}}
          port: '22'
          script: | 
            cd www/htdocs/src/    
Maik Lowrey
  • 15,957
  • 6
  • 40
  • 79

1 Answers1

1

I found out what the problem was. For all those who have the same or similar problems in the future. With GitHub Secrets I made the mistake of storing the password under Environments. But it has to be stored under Repository Secret.

The next question I had was what is the difference between Repository and Enviroment Secret? For the short answear take a look to the comment below from @jessehouwing. Or / and take a look to the posted link from @Nasir Rabbani https://stackoverflow.com/a/65958690/13889413.

Maik Lowrey
  • 15,957
  • 6
  • 40
  • 79
  • 2
    Repository Secrets are true across all stages of a pipeline. Environment secrets only in a deployment stage targeting a specific environment. – jessehouwing Nov 07 '21 at 20:20