The project you were looking for could not be found or you don't have permission to view it

This article helps me to fix git push to gitlab. It’s been a long time i didn’t to commit to 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/josuamarcelc/myproject.git/' not found

git remote set-url origin https://{your_gitlab_username}@gitlab.com/{repo_owner_gitlab_username}/project_repo.git


1. Check Your Remote Origin by

 git remote -v

Result

origin  https://gitlab.com/josuamarcelc/myproject.git (fetch)
origin  https://gitlab.com/josuamarcelc/myproject.git (push)

2. Delete and Add another remote origin

git remote set-url --delete origin https://gitlab.com/josuamarcelc/myproject.git
git remote set-url --add origin https://[email protected]/josuamarcelc/myproject.git

3. Or Shortcut set-url origin

git remote set-url origin https://[email protected]/josuamarcelc/myproject.git

Reference: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/35440