Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.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回购_Git - Fatal编程技术网

为推送设置远程git回购

为推送设置远程git回购,git,Git,我有以下远程目录: /home/darren77 我使用gitinit--bare将目录设置为repo 它添加了.git目录 然后在本地pc上,我有一个目录,它是我的工作区 c:/testAccount/ 然后,我尝试克隆远程回购以设置推送: $ git clone ssh://darren77@tinbad.com/home/darren77.git 但我得到了以下信息: stdin: is not a tty fatal: '/home/darren77.git' does not a

我有以下远程目录:

/home/darren77
我使用
gitinit--bare
将目录设置为repo

它添加了
.git
目录

然后在本地pc上,我有一个目录,它是我的工作区

c:/testAccount/
然后,我尝试克隆远程回购以设置推送:

$ git clone ssh://darren77@tinbad.com/home/darren77.git
但我得到了以下信息:

stdin: is not a tty
fatal: '/home/darren77.git' does not appear to be a git repository
fatal: Could not read from the remote repository

Please make sure you have the correct access rights and the repository exists.
我做错了什么?关于这一点有很多讨论,但没有一个地方真正以绝对基本的格式为git新手提供详细信息,我无论如何也找不到。

试试:

git clone ssh://darren77@tinbad.com/home/darren77/.git
git init--bare
可以在
/home/darren77

该回购协议更合适的名称是:

cd /home/darren77
git init --bare myrepo
这将创建一个
myrepo.git/
文件夹(以
.git
结尾的文件夹)

然后,您将使用以下命令克隆它:

git clone ssh://darren77@tinbad.com/home/darren77/myrepo.git

您可能不应该将主目录作为存储库。创建一个名为
repos
的子目录,然后在其中创建一个包含项目名称和
.git
后缀的裸存储库。路径应该是
/home/darren77/repos/project0.git
。该目录中将包含
.git
目录的内容(即一个裸存储库)

git init--bare
不应创建
.git
目录。如果是的话,就是出了问题

验证这些之后,请尝试
sshdarren77@tinbad.com
查看是否可以正确连接到服务器。如果是,请考虑使用这个语法(这是我使用的)。
git克隆darren77@tinbda.com:/home/darren77/repos/project0.git

用户darren77可能没有对
.git
目录的读取权限。ssh身份验证是如何工作的?用户名/密码或基于密钥的密码正确无误!虽然我在其他地方;We search具有相同的dir结构,他们说remove trailingslash@DarrenSweeney我已经更新了答案,为您的裸回购提供了更合适的名称。