I donβt know exactly why, but it seems that after git clone $(shell) cannot cd into the directory. You can simply execute the whole act with a single call to $(shell) .
all: download echo '$(GIT_COMMIT)' download: $(eval GIT_COMMIT = $(shell git clone git@github.com :proj/project.git buildarea/project && cd buildarea/project && git rev-parse HEAD)) echo '$(GIT_COMMIT)'
source share