4

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
Bilal El Mahdaoui
  • 184
  • 1
  • 1
  • 10

3 Answers3

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).
Bilal El Mahdaoui
  • 184
  • 1
  • 1
  • 10
1

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!).

stackprotector
  • 10,498
  • 4
  • 35
  • 64
  • 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](https://git.symptoma.com/help/ci/jobs/ci_job_token#allow-access-to-your-project-with-a-job-token) 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 :) – Rafael-WO Aug 11 '23 at 10:25
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 Token@git.systems.com/front-end/angular/project.git

Emin Bilgiç
  • 972
  • 6
  • 23