0

AWS で git サーバーをセットアップしました。Mac と ubuntu では問題なく動作しましたが、Windows を使用して接続するのに問題がありました。ここに私が得た手順とエラーがあります。

手順:

1. generate keys using "ssh-keygen -t rsa -b 4096"
2. put the key on server using "echo 'sshkey' >> .ssh/authorized_keys"
3. init repo on windows, set remote to "git remote add origin git@git-myserver-GitName.git"
4. setup config file with the public ip:
    Host git-myserver
        HostName <publicIP>
        User git
        IdentityFile ~/.ssh/keyForGitServer
        RequestTTY no

5. git pull origin master

そして、次のエラーが表示されます。

fatal: 'git@git-myserver-GitName.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

任意の提案をいただければ幸いです。

4

1 に答える 1

2

あなたの質問では、次のものを使用していると述べました。

git@git-myserver-GitName.git

これは有効なリポジトリ仕様ではありません。git に (a) 使用するユーザー名、(b) 使用するリモート ホスト、(c) リモート ホスト上のどのリポジトリを使用するかを伝える必要があります。ssh リポジトリ仕様の正規の形式は次のとおりです。

<user>@<remotehost>:<path_to_repository>

したがって、gitユーザーとしてリポジトリに接続しmyserver.example.comてアクセスする場合は、次を使用します。/repos/myrepo.git

git remote add origin git@myserver.example.com:/repos/myrepo.git

リモート ホーム ディレクトリに相対的なリポジトリの場合は、相対パスを使用できます。

git remote add origin git@myserver.example.com:myrepo.git

SSH リモートを次のように指定することもできます。

ssh://<user>@<remotehost>/<repository>

詳細については、ドキュメントを参照してください。

于 2016-04-15T13:17:46.927 に答える