我创建了一个新项目并尝试推送新存储库。
我的做法是这样的:
git init
git remote add origin https://gitlab.com/test.dev/project1.git
git add .
git commit -m 'Initial commit'
git push origin master
这里是错误:
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/test.dev/project1.git/' not found
我已经尝试删除并重新申请仍然无效。
答案 0 :(得分:1)
如果没有任何协议(ssh 和 https)有效并且存在这样的存储库,则
在 this post 上找到答案。
通过简单地将用户名添加到 url 来解决这个问题,如下所示,
之前: https://gitlab.com/gitlab_user/myrepo.git
之后: https://gitlabusername@gitlab.com/gitlab_user/myrepo.git
记住'gitlabusername'是你的gitlab用户名,第二个gitlab_user是项目所有者,所以完整的网址为:https://your_gitlab_username@gitlab.com/repo_owner_gitlab_username/repo_name.git
答案 1 :(得分:0)
如果你的仓库是私有的,你需要使用 ssh
看起来像 git@gitlab.com:test.dev/project1.git
更换你的远程原点会帮助你
执行此操作的命令如下所示:
git remote set-url origin git@gitlab.com:test.dev/project1.git