问题现象:
运行git clone拉取项目代码时候提示:
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.demo.com/product/gitlab-instance-d8c9751f/devops.git/' not found
$ git clone --progress -v "https://gitlab.demo.com/product/gitlab-instance-d8c9751f/devops.git" "D:\project\screen"
Cloning into 'D:\project\screenporta'...
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.demo.com/product/gitlab-instance-d8c9751f/devops.git/' not found
解决方法:
在仓库地址前添加用户名和密码即可,方法如下:
仓库地址前添加用户名和密码,这种方式有个小问题。如果密码带“@”,命令将运行失败。
$ git clone "https://username:password@xxx.com/console/project.git"
仓库地址前仅添加用户名,回车后会弹出密码输入框。输入即可。
$ git clone "https://username@xxx.com/console/project.git"
示例:
$ git clone --progress -v "https://spring@gitlab.demo.com/gitlab-instance-d8c9751f/devops.git" "D:\project\screen"
Cloning into 'D:\project\screen'...
POST git-upload-pack (275 bytes)
remote: Enumerating objects: 57, done.
remote: Counting objects: 100% (57/57), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 721 (delta 33), reused 0 (delta 0), pack-reused 664
Receiving objects: 100% (721/721), 2.61 MiB | 2.13 MiB/s, done.
Resolving deltas: 100% (220/220), done.