Git shows 'You don't have permission to view it'

Suddenly, I can’t access repository by using ssh now.

The configurations are correctly set and followings are correctly done.

  1. ssh-key is correctly set in my account
  2. ssh -T git@address shows “Welcome to GitLab, Anonymous!”
  3. clone by http works
  4. email and user name are correctly set, which are also used in gitlab account.

However, if I tried to push or clone, the git shows:

remote: ========================================================================
remote: The project you were looking for could not be found or you don’t have permission to view it.
remote: ========================================================================
fatal: Could not read from remote repository.

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

I couldn’t understand what happens here and find any related issues.

1 Like

You can set git verbose options for diagnosing :
On Linux/MacOS

export GIT_TRACE=true
export GIT_CURL_VERBOSE=true
export GIT_SSH_COMMAND=“ssh -vvv”

On Windows
set GIT_TRACE=true
set GIT_SSH_COMMAND=ssh -vvv

then execute git clone for reproduce the issue

git clone git:///path/to/repo.git

now you can check logs for issue, and focus on “No such file or directory” message.

If you under Cywin terminal, make sure

The id_rsa file should be copied to the <Cywin_HOME>/cygwin64/home//.ssh/ directory.

Such as the id_rsa file from the C:\Users<USERNAME>.ssh directory.