简体   繁体   English

正确的Windows网址以访问我自己的git服务器

[英]Correct url for windows to access my own git server

So i've got my git server setup on AWS, it worked perfectly fine on my mac and ubuntu, but i got trouble connecting it using windows. 因此,我在AWS上安装了git服务器,在Mac和ubuntu上运行都很好,但是我无法使用Windows连接它。 Here is the steps and the error i got. 这是步骤和我得到的错误。

Steps: 脚步:

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

And it gives me the following errors: 它给了我以下错误:

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.

Any suggestions would be appreciated. 任何建议,将不胜感激。

In your question, you said you're using: 在您的问题中,您说您正在使用:

git@git-myserver-GitName.git

This isn't a valid repository specification; 这不是有效的存储库规范; you need to tell git (a) what username to use, (b) what remote host to use, and (c) what repository on the remote host to use. 您需要告诉git(a)使用什么用户名,(b)使用什么远程主机,以及(c)使用远程主机上的哪个存储库。 The canonical format of an ssh repository specification is: ssh存储库规范的规范格式为:

<user>@<remotehost>:<path_to_repository>

So if you are connecting as the git user to myserver.example.com and accessing the /repos/myrepo.git repository, you would use: 因此,如果您以git用户身份连接到myserver.example.com并访问/repos/myrepo.git存储库,则可以使用:

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

For repositories that are relative to your remote home directory you can use relative paths: 对于相对于远程主目录的存储库,可以使用相对路径:

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

You can also specify an SSH remote as: 您还可以将SSH远程指定为:

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

More information is in the documentation . 更多信息在文档中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM