How to fix 'The project you were looking for could not be found' when using git clone
GitGitlabProjectGit BashCloningGit Problem Overview
I am trying to clone a project from gitlab to my local machine. I have been granted rights as a developer, and use the command 'git clone
- None of the protocols work (ssh and https neither work)
The error message I am getting:
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/KZA_Connected/skilltree.git/' not found
Any help would be highly appreciated.
Git Solutions
Solution 1 - Git
I solved this by simply adding username to url like below,
Solution 2 - Git
Today, I was having the same issue. The repo was working fine at my home machine, but when I tried the same repo in other machine I started facing the same error. I was using below URL
https://gitlab.com/{gitlab_user}/project_repo.git
And now I changed above URL to below
https://{gitlab_user}@gitlab.com/gitlab_user/project_repo.git
And it worked for me. Above solution was found at below URL
https://medium.com/@imstudio/gitlab-the-project-you-were-looking-for-could-not-be-found-issue-685944aa5485
Hope this helps other.
Solution 3 - Git
On mac osx, it usually means that your ssh credentials are not loaded. Brute force solution:
cd ~/.ssh
ssh-add *
I have to do this every time my Macbook reboots.
Solution 4 - Git
I have two gitlab accounts. For both I use ssh keys. Both are hosted by gitlab (not self-hosted).
When you run
ssh -T git@gitlab.com
It will return your username.
Welcome to GitLab, @username1!
I was using ssh for @username1 and @username2. It defaults to the first ssh found. So, AFAIK, it's impossible to have two accounts with ssh.
My solution was to rm ssh key from the gitlab account I am not using.
Solution 5 - Git
Simple Answer: Reset your already existing origin using the following command.
git remote set-url origin https://[email protected]/some-group/project.git
For you it's,
git remote set-url origin https://[email protected]/KZA_Connected/skilltree.git
git remote -v
(To check if the changes are reflected), then
git push origin master
Finished.
If it's the first time after the git init
Then
> git remote add origin https://[email protected]/gitlabUsername/project_repo.git
Because git remote add origin https://gitlab.com/gitlabUsername/project_repo.git
will not work, use the above instead.
If still you get the error, then Remove remote origin by the following and add a new one again
git remote remove origin
Solution 6 - Git
I solved the above problem
Before: https://gitlab.com/gitlab_user/myrepo.git
After: https://<gitlabusername>@gitlab.com/gitlab_user/myrepo.git
Explanation:
Type your gitlabUsername in place of <gitlabusername>
.
Now, it will ask for gitlab password for that your account. Enter the correct password and the project will be cloned successfully.
Solution 7 - Git
If you (like me) have added multiple ssh keys, the solution is to explicitly state which key should be used for a remote host.
Add the following lines to the ~/.ssh/config file, depending on your use case:
Host bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa
Host gitlab.com
User git
IdentityFile ~/.ssh/id_ed25519
Solution 8 - Git
If adding the ssh key does not work, follow this -
eval "$(ssh-agent -s)"
Then add the ssh key
ssh-add ~/.ssh/<id_rsa>
Solution 9 - Git
There is credential manager on windows, which contains details about credentials of your host here is s.s of credential manager
- First of all make sure you have same user credentials which have access to repository which you are trying to clone. If you have correct credentials
then try this url formatter
https://{username}@gitlab.com/username/repo-name.git
in your case it will be like this
'https://[email protected]/KZA_Connected/skilltree.git/'
i was able to solve my problem deleting my credentials and adding them again i hope this help others too
-- Important note this credential manager save your global credentials, you can set your local credentials too using git config
git config --local user.name "Your name"
git config --local user.email "Your email"
git config --local credential.helper "store"
if you set credential.helper
to store, in current local git scope it will ask you password every time you do action like pull, push etc
if you want to reset credential.helper, then simply set it back to manager
it will work fine as before
Solution 10 - Git
If you are facing the issue for a fresh repo
Just simply change the gitlab default https url from https://gitlab.com/rscodelab/project.git to https://[email protected]/rscodelab/project.git
> for example
> git clone https://gitlab.com/gitlabusername/project.git
> to
> git clone https://[email protected]/gitlabusername/project.git
Solution 11 - Git
First of all verify your credentials are correct.
git config user.email
git config user.name
If they are correct, try appending your username@
before your repo address.
E.g. Instead of
git clone https://repo.abc.com/projectname.git
Try
git clone https://[email protected]/projectname.git
Solution 12 - Git
In my case, I was not adding .git at the end of URL.
https://gitlab.com/{gitlab_user}/project_repo
corrected to
https://gitlab.com/{gitlab_user}/project_repo.git
This might seem like a silly mistake, but that was it!
Solution 13 - Git
Solution: it was due my windows credentials being set to an other email account.
Solution 14 - Git
Put username before the url like this:
git clone https://[email protected]/projectname.git
To add git to an existing folder accordingly:
git remote add origin https://[email protected]/projectname.git
Solution 15 - Git
If it's the first time after the git init command, Then use the below command
git remote add origin https://[email protected]/gitlabUsername/project_repo.git
Because git remote add origin https://gitlab.com/gitlabUsername/project_repo.git will not work, use the above instead.
If still you get the error, then Remove remote origin by the following and retry again by adding the origin using the correct command. to remove origin - git remote remove origin
Solution 16 - Git
I honestly don't know how GitLab works, I use GitHub, but check if the repo is marked as private.
I had similar issue on GitHub where my friend couldnt retrieve and clone my repo even though he had a status of "Contributor" cz I accidentaly checked it to be Private. Also check if your GitLab account and one you are using in your Command line tool is matching.
Solution 17 - Git
if your git --version > 2.10
run the following command in your project repo :
git config --add core.sshCommand "ssh -o IdentitiesOnly=yes -i ~/.ssh/path-to-your-key -F /dev/null"
Solution 18 - Git
- Open a spotlight search.
- Go to Keychain Access.
- Search for GitLab.
- Make sure your account(username) and password match the GitLab credentials for the account you're using to clone the repo.