Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 18

How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

Solved! Go to Solution.

I'm trying the Lab Course Hello, GitHub Actions!, but I'm stuck at the second step when I should Add an entrypoint script. I've created the file entrypoint.sh using the Web UI, then cloned the Git repository as suggested in the PR https://github.com/thinkh/hello-github-actions/pull/2. However, I'm stuck when I should make the script executable. How does this work on Windows? Is there a way to bypass this check?

17 Replies
Moderator
Message 2 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

Hi @thinkh! I believe that the step is necessary - the file's correct permissions are required for GitHub Actions to execute the script.

 

This is absolutely possible on Windows! It depends a bit on which terminal or shell you're using. If you're using Git Bash from git-scm.com, the commands would be identical to the ones listed in the course. 

 

Which terminal are you using locally? 

Copilot Lvl 3
Message 3 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

Hi @brianamarie! Thanks for your reply. I've tried multiple terminals (Powershell, Git Bash, Ubuntu WSL). You are right that I can run the command on the Git Bash. Afterwards, however, there is no change I can commit, as the following console log shows:

 

 

user@LAPTOP MINGW64 /d/w/hello-github-actions (first-action)
$ chmod +x action-a/entrypoint.sh

user@LAPTOP MINGW64 /d/w/hello-github-actions (first-action)
$ git status
On branch first-action
Your branch is up to date with 'origin/first-action'.

nothing to commit, working tree clean

user@LAPTOP MINGW64 /d/w/hello-github-actions (first-action)
$

 

The same applies to the Ubuntu WSL. Powershell does not support the command and throws an exception.

 

My assumption is that the underlying disk format (NTFS) does not support that file permission. Do you have any other idea what I could try?

 

Moderator
Message 4 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

Hmm, that's interesting @thinkh. Let's check to see if the file does in fact have the correct permissions. I'm not sure why that wouldn't be something to commit. To check if the file is executable, run `ls -al`. The output should have something like `-rwxr-xr-x` listed before it. 

 

Have you pushed the changes you do have? If so, is the course reacting as expected?

Solution
Copilot Lvl 3
Message 5 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

The first time I checked out the repo using Git Extensions and followed the steps as I explained on different terminals. That didn't work as I described before.

 

To verify what I did, I've tried all steps (checkout, chmod, commit and push) inside the Ubuntu WSL and this time it worked. You can see my last commit and the bot message in my PR. So it seems to be different when you checkout the repository in Windows rather than a Linux system.

 

user@LAPTOP:/d/w$ git clone https://github.com/thinkh/hello-github-actions.git hello2
Cloning into 'hello2'...
remote: Enumerating objects: 25, done.                                                                                  remote: Counting objects: 100% (25/25), done.                                                                           remote: Compressing objects: 100% (21/21), done.                                                                        remote: Total 25 (delta 3), reused 19 (delta 2), pack-reused 0                                                          Unpacking objects: 100% (25/25), done.
user@LAPTOP:/d/w$ cd hello2
user@LAPTOP:/d/w/hello2$ git checkout first-action
Branch 'first-action' set up to track remote branch 'first-action' from 'origin'.
Switched to a new branch 'first-action'
user@LAPTOP:/d/w/hello2$ chmod +x action-a/entrypoint.sh
user@LAPTOP:/d/w/hello2$ git add action-a/entrypoint.sh

user@LAPTOP:/d/w/hello2$ git status                                                                          On branch first-action
Your branch is up to date with 'origin/first-action'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   action-a/entrypoint.sh                                                                              

user@LAPTOP:/d/w/hello2$ git commit -m "make entrypoint script executable"                                   [first-action 8d8dfea] make entrypoint script executable
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 action-a/entrypoint.sh

user@LAPTOP:/d/w/hello2$   

 

To verify the steps I also tried all the steps using the Git Bash, but again there was nothing to commit afterwards.

 

user@LAPTOP MINGW64 /d/w
$ git clone https://github.com/thinkh/hello-github-actions.git -b permission-on-git-bash hello3
Cloning into 'hello3'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 28 (delta 3), reused 22 (delta 2), pack-reused 0
Unpacking objects: 100% (28/28), done.

user@LAPTOP MINGW64 /d/w
$ cd hello3

user@LAPTOP MINGW64 /d/w/hello3 (permission-on-git-bash)
$ chmod +x action-a/entrypoint.sh

user@LAPTOP MINGW64 /d/w/hello3 (permission-on-git-bash)
$ git add action-a/entrypoint.sh

user@LAPTOP MINGW64 /d/w/hello3 (permission-on-git-bash)
$ git commit -m "make entrypoint script executable"
On branch permission-on-git-bash
nothing to commit, working tree clean

user@LAPTOP MINGW64 /d/w/hello3 (permission-on-git-bash)
$

 

Copilot Lvl 2
Message 6 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

Possibly a simpler solution for Windows users who don't want to or can't install things is to use https://repl.it/languages/bash - follow the steps as in the tutorial, except before git pushing it will prompt you to set your user email/name:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

You will also need to enter your github username and password after the push command. 

Ground Controller Lvl 1
Message 7 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

I am using Ubuntu WSL and still, nothing to commit...

ubuntuclone.PNG

Ground Controller Lvl 2
Message 8 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

Try the following command

git update-index --chmod=+x action-a/entrypoint.sh

that worked for me.

Copilot Lvl 2
Message 9 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

If I understand you correctly, don't use git bash but use WSL, right?

Copilot Lvl 3
Message 10 of 18

Re: How to make the script executable on Windows (to proceed the GitHub Actions Lab Course)?

The command from @TechWatching worked for me in Git Bash.