2017-10-11 52 views
1

所有,git的问题,当添加一个新的本地文件夹作为远程项目

我有一个非常简单的问题,却没有发现在10分钟一个很好的解释和解决方案。所以我认为最好在这里问问。通常,我遵循使用web ui创建远程项目的规则,然后启动本地。但今天,我遵循下面的规则(从here)添加一个本地文件夹作为一个新的远程git项目。

$git init 
$git add . 
$git commit -m ... 
$git remote add origin https://gitlab.com/group/project 
$git remote -v 
$git push origin master 

一切都很顺利,直到最后一步。我在下面发现了一个错误:

fatal: https://gitlab.com/group/project/info/refs not valid: is this a git repository 

如何进一步检查发生了什么以及如何解决此错误?

感谢

+1

看来你跑'git的远程添加原产https://gitlab.com/group/project结束项目/信息/裁判/'。运行'git remote -v'来检查url是否正好是'https:// gitlab.com/group/project'。如果没有,运行'git remote set-url origin https:// gitlab.com/group/project'来更新url。 – ElpieKay

+0

谢谢。使用set-url更改网址。但有新的错误:找不到您正在寻找的项目。致命的:repository'gitlab.com/group/project.git/';找不到 – zhihong

+0

我不确定'group',但我不认为'project'是远程仓库的真实名称。你可以浏览你的Gitlab网页来找出版本库的名称。假设在Gitlab中存储库是'foo.git',那么url应该是'https://gitlab.com/group/foo'或'https://gitlab.com/group/foo.git'。 – ElpieKay

回答

1

你只需要有效的URL添加到与.git

https://gitlab.com/group/project.git 
+0

嗨,谢谢。我认为这与URL末尾的.git有关。我重置了网址,现在“git push origin master”起作用。但后来又出现了一个新的错误:remote:找不到你正在查找的项目。 fatal:repository'https://gitlab.com/group/project.git/'找不到 – zhihong

+0

你确定'https://gitlab.com/group/project.git'是真实的url吗? – Marusyk

+0

嗨,对不起,不,它不存在于我的git存储库中。我认为它会自动使用“git remote add”创建。那么我怎么能从cmd行创建一个有效的url? – zhihong

相关问题