For the error *"Error creating environment: error creating environment: Ref HEAD cannot be resolved"*, I would ensure the below,
* Chech whether the branch exists.
* Try using different branch. eg. default branch (master)
* Check the privileges of the user account over the VCS repository **branch** configured under VCS configuration.
Hope this helps!