remote: The project you were looking for could not be found or you don't have permission to view it
Asked Answered
M

4

6

I'm getting this error while trying to deploy my branch through gitlab.

remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.com/[group_name]/[repo_name].git/' not found
error: Could not fetch origin
Mangan answered 4/2, 2022 at 8:47 Comment(0)
M
9

I managed to resolve my problem. If you're encountering the same problem, follow these steps :

  • Rename your old remote tracking :

git remote rename origin old_origin

  • Add the new remote :

git remote add origin https://[gitlab_username]@gitlab.com/[group_name]/[repo_name].git

  • You'll probably also have to set your default remote to origin :

git config --add checkout.defaultRemote origin

  • And finally, you can delete old_origin if you want (optional).
Mangan answered 4/2, 2022 at 9:49 Comment(1)
Crazy! Why does it just stop working like that? Thanks for the help.Phenanthrene
T
6

I did get this error only in a CI pipeline when cloning submodules. Reason was the CI/CD > Token Access > Allow access to this project with a CI_JOB_TOKEN setting of the submodules. In newer GitLab versions "Token Access" has different default settings than before.

So in CI/CD, make sure your repos are accessible by certain tokens or disable that feature (not recommended, security risk!).

Tammy answered 31/7, 2023 at 13:29 Comment(1)
Thanks a lot for this answer! I have a CI job that updates my submodules within a project and suddenly this failed after I added a new project as a submodule. The reason was that for the older projects the allowlist-feature was still disabled but for the new one it was enabled and did not include the parent project. After adding my parent project the job passed again! This saved my day :)Whiz
S
1

In my case, on GitLab v17.2.2, there were 2 solutions:

Solution 1:

Add the deploy key used by the pipeline project in the submodule project here: Settings > Repository > Deploy keys

Solution 2:

Update the following setting in the submodule project here: Settings > CI/CD > Job token permissions. From here, either enable Limit access to this project option and add a group or project (recommended) or disable Limit access to this project option (not recommended).

Simulated answered 20/8 at 10:17 Comment(0)
C
0

I have solved this issue Using Acces Code.

Step 1: Create Access Token (If you have one then You can use that also.)

Step 2: git clone your URL.

step 3: Add Access Token after https://Access Token: Access Token@ and our Url as same.

Example: git clone https://Access Token:Access [email protected]/front-end/angular/project.git

Conversational answered 15/6, 2022 at 5:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.