【问题标题】:Correct url for windows to access my own git server正确的 url 让 windows 访问我自己的 git 服务器
【发布时间】:2016-08-05 19:08:02
【问题描述】:

所以我已经在 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.

任何建议将不胜感激。

【问题讨论】:

  • 我相信你必须在第一次拉之前做一个 git clone...
  • git@git-myserver-GitName.git 不是有效的存储库规范。你想要&lt;user&gt;@&lt;host&gt;:&lt;path&gt;,例如git@git-myserver.com:path/to/GitName.git
  • @larsks thx!,我认为这是我正在寻找的解决方案,当我在我的 Windows 笔记本电脑上进行测试时,我会回复你!
  • @larsks,它成功了!,除了我使用 git-myserver 而不是 git-myserver.com 作为主机,你想把它移到回答部分以便我们可以关闭这个问题吗?

标签: git amazon-web-services git-shell


【解决方案1】:

在你的问题中,你说你正在使用:

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>

更多信息在the documentation

【讨论】:

    猜你喜欢
    • 2016-12-21
    • 2022-10-13
    • 1970-01-01
    • 2012-09-02
    • 1970-01-01
    • 2016-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多