tij*_*ter 51 git project cloning git-bash gitlab
我正在尝试将一个项目从 gitlab 克隆到我的本地机器。我已被授予开发人员权限,并使用命令 'git clone
我收到的错误消息:
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/KZA_Connected/skilltree.git/' not found
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
Abd*_*han 69
我通过简单地将用户名添加到 url 来解决这个问题,如下所示,
之前:https : //gitlab.com/gitlab_user/myrepo.git
之后: https://gitlabusername@gitlab.com/gitlab_user/myrepo.git
Abd*_*eed 32
今天,我遇到了同样的问题。回购在我的家用机器上运行良好,但是当我在其他机器上尝试相同的回购时,我开始面临同样的错误。我正在使用以下网址
https://gitlab.com/{gitlab_user}/project_repo.git
Run Code Online (Sandbox Code Playgroud)
现在我将上面的 URL 更改为下面
https://{gitlab_user}@gitlab.com/gitlab_user/project_repo.git
Run Code Online (Sandbox Code Playgroud)
它对我有用。在以下 URL 中找到了上述解决方案
https://medium.com/@imstudio/gitlab-the-project-you-were-looking-for-could-not-be-found-issue-685944aa5485
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助其他人。
小智 15
在 mac osx 上,这通常意味着您的 ssh 凭据未加载。暴力破解:
cd ~/.ssh
ssh-add *
Run Code Online (Sandbox Code Playgroud)
每次我的 Macbook 重新启动时,我都必须这样做。
Sam*_*lwe 15
如果您(像我一样)添加了多个 ssh 密钥,解决方案是明确声明远程主机应使用哪个密钥。
根据您的用例,将以下行添加到 ~/.ssh/config 文件中:
Host bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa
Host gitlab.com
User git
IdentityFile ~/.ssh/id_ed25519
Run Code Online (Sandbox Code Playgroud)
小智 11
首先验证您的凭据是否正确。
git config user.email
git config user.name
Run Code Online (Sandbox Code Playgroud)
如果它们正确,请尝试username@在存储库地址之前附加您的地址。
例如,而不是
git clone https://repo.abc.com/projectname.git
Run Code Online (Sandbox Code Playgroud)
尝试
git clone https://username@repo.abc.com/projectname.git
Run Code Online (Sandbox Code Playgroud)
如果您面临新回购的问题
只需简单地将 gitlab 默认 https url 从https://gitlab.com/rscodelab/project.git更改为 https://rscodelab@gitlab.com/rscodelab/project.git
例如
git clone https://gitlab.com/gitlabusername/project.git
到
git clone https://gitlabusername@gitlab.com/gitlabusername/project.git
小智 8
我解决了上面的问题
前: https://gitlab.com/gitlab_user/myrepo.git
后: https://<gitlabusername>@gitlab.com/gitlab_user/myrepo.git
解释:
输入您的gitlabUsername代替<gitlabusername>.
现在,它会询问您帐户的 gitlab 密码。输入正确的密码,即可成功克隆项目。
简单回答:使用以下命令重置您已经存在的原点。
git remote set-url origin https://gitlabUsername@gitlab.com/some-group/project.git
对你来说,
git remote set-url origin https://gitlabUsername@gitlab.com/KZA_Connected/skilltree.git
Run Code Online (Sandbox Code Playgroud)
git remote -v (检查是否反映了更改),然后
git push origin master
完成的。
如果是之后的第一次 git init
然后
git remote add origin https://gitlabUsername@gitlab.com/gitlabUsername/project_repo.git
因为git remote add origin https://gitlab.com/gitlabUsername/project_repo.git行不通,所以改用上面的。
如果仍然出现错误,则通过以下操作删除远程源并再次添加一个新的
git remote remove origin
我有两个 gitlab 帐户。对于两者,我都使用 ssh 密钥。两者都由 gitlab 托管(不是自托管)。
当你跑
ssh -T git@gitlab.com
Run Code Online (Sandbox Code Playgroud)
它将返回您的用户名。
Welcome to GitLab, @username1!
Run Code Online (Sandbox Code Playgroud)
我为@username1 和@username2 使用ssh。它默认为找到的第一个 ssh。所以,AFAIK,不可能有两个 ssh 帐户。
我的解决方案是从我没有使用的 gitlab 帐户 rm ssh 密钥。
Windows 上有凭据管理器,其中包含有关主机凭据的详细信息,这里是凭据管理器的 ss

然后试试这个 url 格式化程序
https://{username}@gitlab.com/username/repo-name.git
Run Code Online (Sandbox Code Playgroud)
在你的情况下,它会是这样的
'https://username@gitlab.com/KZA_Connected/skilltree.git/'
Run Code Online (Sandbox Code Playgroud)
我能够解决删除我的凭据并再次添加它们的问题我希望这也能帮助其他人
-- 重要说明这个凭证管理器保存您的全局凭证,您也可以使用 git config 设置您的本地凭证
git config --local user.name "Your name"
Run Code Online (Sandbox Code Playgroud)
git config --local user.email "Your email"
Run Code Online (Sandbox Code Playgroud)
git config --local credential.helper "store"
Run Code Online (Sandbox Code Playgroud)
如果您设置credential.helper为存储,则在当前本地 git 范围内,每次您执行拉、推等操作时,它都会询问您密码
如果你想重置 credential.helper,那么只需将它设置回manager
它就会像以前一样正常工作
将用户名放在 url 之前,如下所示:
git clone https://username@repo.abc.com/projectname.git
Run Code Online (Sandbox Code Playgroud)
相应地将 git 添加到现有文件夹:
git remote add origin https://username@repo.abc.com/projectname.git
Run Code Online (Sandbox Code Playgroud)
小智 5
如果添加 ssh 密钥不起作用,请按照以下步骤操作 -
eval "$(ssh-agent -s)"
Run Code Online (Sandbox Code Playgroud)
然后添加ssh密钥
ssh-add ~/.ssh/<id_rsa>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
91449 次 |
| 最近记录: |