簡體   English   中英

Git“似乎不是一個 git 存儲庫”

[英]Git "does not appear to be a git repository"

我正在嘗試在服務器上安裝 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

我用谷歌搜索並按照我能找到的所有內容進行操作,但沒有任何效果。 可能有什么問題?

我假設你使用ssh來克隆你的回購。

這意味着您需要在ssh地址中服務器上的repo的完整路徑:

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中,有一些東西需要輸入。

可能你忘了在遠程文件夾上運行git --bare init那是我的問題

或者,您可以簡單地使用:

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

非 chroot 的 git 用戶也可能是問題來源,設置用戶的主目錄 ( ~/ ) 也可能有幫助。 例如,更改:

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

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

相關: Git“似乎不是一個 git 存儲庫”當您...時,也可以在路徑中使用 ~

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM