Skip to content

Handle project creation error on git push

Vasilii Iakliushin requested to merge 463035_handle_creation_error into master

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

  1. Clone a project from GDK
  2. Visit local copy of the project
  3. Open .git/config
  4. Add . at the end of the project's path (like url = ssh://git@gdk.test:2222/new-group/test-repo.git.)
  5. Try to push the branch git push back to GDK
  6. You should see an error message instead of a Internal API unreachable
Edited by Vasilii Iakliushin

Merge request reports