No, you can't. Nothing will check SHA256 of a malware downloaded in this way, so nothing will stop malware from owning your host.
To check, just put "127.0.0.1 gitlab.com" into your /etc/hosts and try to serve your own file from your URL. Git will detect this, curl will not.