Git““似乎不是git存储库””

v1uwarro  于 2022-12-25  发布在  Git
关注(0)|答案(4)|浏览(188)

我尝试在服务器上安装git,但在第一次push时出现了一些问题。我成功地在服务器上安装了git,在本地和服务器上创建了仓库,但当我尝试第一次push时,我收到了以下消息:

stdin: is not a tty
fatal: '/my_repo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

我在谷歌上搜索了一下,追踪了我能找到的所有东西,但都不起作用。会出什么问题呢?

qhhrdooz

qhhrdooz1#

我将假设您使用ssh来克隆您的repo。
这意味着在ssh地址中需要存储库在服务器上的完整路径:

git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo

注意:如果你的'my_repo'是一个空的(允许推送),那将是:

git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo.git

stdin: is not a tty仅仅意味着在sshuser帐户的.bashrc中,有一些东西需要输入。
Abpostman1在注解中添加:
有这个问题,因为我试图推入一个--bare repo非空。
即使是完全相同的文件,我有相同的错误消息:“Not git repository
我必须备份我的/httpdocs远程文件夹,创建一个空的新/httpdocs文件夹,再次做git init --bare和从本地重新推送。
我的远程地址:url = ssh://magento@magento/home/magento/httpdocs(双方都有私钥/公钥)

wribegjk

wribegjk2#

可能是你忘了在远程文件夹上运行git --bare init那是我的问题

kninwzqo

kninwzqo3#

或者,您可以简单地用途:

git clone user@server:/full/path/to/your/directory
kq0g1dla

kq0g1dla4#

一个非jailed/非chroot的git用户也可能是问题源,设置用户的主目录(~/)也会有所帮助。

git clone -- 'ssh://user@host:port/dir/repo.git';

git clone -- 'ssh://user@host:port/~/dir/repo.git';

相关:Git“看起来不像git仓库”(* 当您 *...)

相关问题