Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Git repo设置为服务器(源站)并获取其url_Git - Fatal编程技术网

将Git repo设置为服务器(源站)并获取其url

将Git repo设置为服务器(源站)并获取其url,git,Git,我想建立一个git回购协议,它将被其他人克隆。比如说,这个服务器就是gitserver.com 因此,在我的项目目录gitserver.com~/nodejs/project中,我执行了git init、git add和git commit 现在要在另一台机器上克隆它,我尝试了以下方法:- git clone ssh://root@gitserver.com/nodejs/project git clone ssh://root@gitserver.com/nodejs/project.git

我想建立一个git回购协议,它将被其他人克隆。比如说,这个服务器就是gitserver.com

因此,在我的项目目录gitserver.com~/nodejs/project中,我执行了git init、git add和git commit

现在要在另一台机器上克隆它,我尝试了以下方法:-

git clone ssh://root@gitserver.com/nodejs/project
git clone ssh://root@gitserver.com/nodejs/project.git
git clone git://root@gitserver.com/nodejs/project
git clone git://root@gitserver.com/nodejs/project.git
但是我得到了这个错误-

克隆到“项目”。。。致命错误:“/nodejs/project.git”未出现 成为git存储库致命:无法从远程存储库读取

请确保您拥有正确的访问权限和存储库 存在


那么,我是否错过了任何一步?如何获取在gitserver.com中创建的repo的url?

本地和远程git repo之间存在差异。远程的,因为它是中心存储库,来源

在~remote/project目录中

git init——裸

转到您的本地目录

git remote添加源代码~/remote/project

git提交-a-m“初始提交”

git-push-u源主机


远程存储库必须使用bare标志创建(因为它不需要工作目录)
git init--bare yourproject.git
更多信息: