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

Posted on Fri 24 November 2023 in misc

The most common errors occur when deploying a Go project from GitLab repositories.

"golang remote: The project you were looking for could not be found or you don't have permission to view it."

OR

"fatal could not read username for 'https //gitlab.com' terminal prompts disabled"

The main reasons behind that are related to authentication and permissions. To solve that, we need to create the following files and fill them with the suitable credentials with the exact syntax:

1- .gitconfig

2- .git-credentials

3- .netrc

And, for sure, you need to place these files under the home directory of the user being used. Ex. moving the files to home directory:


mv .gitconfig ~/
mv .git-credentials ~/
mv .netrc ~/

Now, lets start with the content of these files with the exact syntax and make sure editing them to your credentials:

1- .gitconfig


[credential]
        helper = store
[user]
        email = username@domain.com
        password = "TheGeneratedTokenFromGitlab"
        name = Your name
[http]
        sslverify = false

2- .git-credentials


https://username:TheGeneratedTokenFromGitlab@domainForGitlab.com

3- .netrc


machine "Put here the execution of command hostname"
login username@domain.com
password "TheGeneratedTokenFromGitlab"