Post

How to fix 'The namespace you were looking for could not be found.' problem with Git

How to fix 'The namespace you were looking for could not be found.' problem with Git

Problem

Today, all of a sudden, my git push stopped working.
Such an error was occurring with every attempt:

1
2
3
4
5
6
7
8
9
10
remote:
remote: ========================================================================
remote:
remote: The namespace you were looking for could not be found.
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

It was strange, as I didn’t change anything neither in git config, nor in any other configurations.

After executing ssh -T git@{gitlab-url} I was receiving the proper response of Welcome to GitLab, @username!

I could also make git pull and everything worked.

The one thing I couldn’t do was git push (or here: git push -u origin branch-name)

Elementary troubleshooting like checking VPN, restarting IntelliJ, using different terminal(s), restarting PC didn’t help, neither StackOverflow solutions.

Solution

I made a new git clone of repository and compared .git/config file.
There was one notable difference:
(Note: {variables} was redacted, replace them with your ones)

1
2
3
[remote "origin"]
	url = git@{gitlab-url}:{namespace}/{repository-name}.git
	fetch = +refs/heads/*:refs/remotes/origin/*
1
2
3
4
[remote "origin"]
	url = git@{gitlab-url}:{username}/{namespace}/{repository-name}.git
	fetch = +refs/heads/*:refs/remotes/origin/*
	pushurl = git@{gitlab-url}:{username}/{namespace}/{repository-name}.gitgitlab-ci-token:@git@{gitlab-url}:{namespace}/{repository-name}.git

I don’t know how this pushurl was set, probably due some refactoring etc.
Nevertheless, it was the culprit.

To fix this I just replaced contents of [remote "origin"] in old file using the ones copied from the new file - and that’s all.