Home > OS >  How to call GitHub Secret in Action
How to call GitHub Secret in Action

Time:11-10

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/    

CodePudding user response:

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.

  • Related