1
votes

I have problem with git repositories.. It's odd problem.

I have cloned project from GitLab with SSH.

I have previously set SSH key for my local machine (works for other projects) I want to push my changes but I get:

fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Odd thing is that I get link from some repository on GitHub ?? Thing is I am logged on my GitLab account with my GitHub account.

I tried with git remote set-url origin https://gitlab.com/project/project-api.git

When I try: git remote -v I get:

composer        https://github.com/project/some-github-project.git (fetch)
composer        https://github.com/googleapis/some-github-project.git (push)

Also tried:

git push -u origin feature/my-first-work

and got:

ERROR: Permission to https://github.com/project/some-github-project.git denied to ben-user.

Can someone help?

1
Set the remote url to use ssh instead of https, something like git remote set-url origin [email protected]:myprofile/my-project.git or [email protected]...Joao Vitorino
Tried. Still getting ERROR: Permission to github.com/project/some-github-project.git denied to ben-user. @JoaoVitorinodispera05

1 Answers

0
votes

As long as you see an HTTPS URL right after setting the origin to an SSH URL, you will have this issue.

Check if you are in the right folder, then check which configuration is set with:

git config -l --show-origin --show-scope

The goal is to check where the HTTPS URL comes from regarding the origin setting.