Handle project creation error on git push
What does this MR do and why?
Contributes to #463035 (closed)
Problem
Gitlab::GitAccessProject::CreationError
is not handled by
internal/allowed
endpoint. When the project fails to create, then we
return Internal API unreachable
error.
Solution
Add a handler for Gitlab::GitAccessProject::CreationError
and return
an error message.
Screenshots or screen recordings
Before
> git push local HEAD
remote:
remote: ========================================================================
remote:
remote: ERROR: Internal API unreachable
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
After
> git push local HEAD
remote:
remote: ========================================================================
remote:
remote: ERROR: Could not create project: Project namespace path can only include non-accented letters, digits, '_', '-' and '.'. It must not start with '-', end in '.', '.git', or '.atom'., Path can only include non-accented letters, digits, '_', '-' and '.'. It must not start with '-', end in '.', '.git', or '.atom'.
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How to set up and validate locally
- Clone a project from GDK
- Visit local copy of the project
- Open
.git/config
- Add
.
at the end of the project's path (likeurl = ssh://git@gdk.test:2222/new-group/test-repo.git.
) - Try to push the branch
git push
back to GDK - You should see an error message instead of a
Internal API unreachable
Edited by Vasilii Iakliushin