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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10391522/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 13:35:04  来源:igfitidea点击:

Git "does not appear to be a git repository"

git

提问by romainberger

I am trying to install git on a server and have some problem when I try to perform the first push. I successfully installed git on the server, created the repository locally and on the server but when I try to make the first push I get this message:

我正在尝试在服务器上安装 git,但在尝试执行第一次推送时遇到了一些问题。我在服务器上成功安装了 git,在本地和服务器上创建了存储库,但是当我尝试进行第一次推送时,我收到以下消息:

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

I googled it and followed everything I could find but nothing worked. What could be wrong?

我用谷歌搜索并按照我能找到的所有内容进行操作,但没有任何效果。可能有什么问题?

回答by VonC

I will assume you are using ssh to clone your repo.

我假设您正在使用 ssh 来克隆您的存储库。

That means you need the full path of the repo on the server in your ssh address:

这意味着您需要 ssh 地址中服务器上的 repo 的完整路径:

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

Note: if your 'my_repo' is a bare one (to allow pushing), that would be:

注意:如果您的“my_repo”是一个裸机(以允许推送),那将是:

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

The stdin: is not a ttysimply means that in the .bashrcof the sshuseraccount, there is something expecting an input.

stdin: is not a tty简单的说就是在.bashrc对的sshuser帐户,有什么期待的输入。

回答by user3353537

May be you forgot to run git --bare initon the remote folder That was my problem

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

回答by dushshantha

Or, you can simply use:

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

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