简体   繁体   English

无法从 Windows 机器连接到 Linux git Repo

[英]Unable to connect to Linux git Repo from Windows machine

So recently I've been trying to set up a Git server to manage personal projects and work.所以最近我一直在尝试搭建一个 Git 服务器来管理个人项目和工作。 I created a bare Git repo on a spare laptop running Ubuntu and I installed Git Bash on my Windows machine.我在运行 Ubuntu 的备用笔记本电脑上创建了一个裸 Git 存储库,并在我的 Windows 机器上安装了 Git Bash。 Right now I'm having some issues in actually being able to clone my Ubuntu git server to my Windows computer.现在我在实际能够将我的 Ubuntu git 服务器克隆到我的 Windows 计算机时遇到了一些问题。

I used git remote add origin myserver@myserver-Dell-System:/home/myserver/CentralRepo.git but whenever I try to clone to my Windows machine, Git bash spits out this error:我使用git remote add origin myserver@myserver-Dell-System:/home/myserver/CentralRepo.git但是每当我尝试克隆到我的 Windows 机器时,Git bash 都会抛出这个错误:

ssh: Could not resolve hostname myserver@myserver-Dell-System: Name or service not known
fatal: Could not read from remote repository.

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

I double checked my add to make sure the address of my Git server was correct and I assume Git bash for Windows comes with OpenSSH.我仔细检查了我的添加以确保我的 Git 服务器的地址是正确的,我假设 Windows 的 Git bash 带有 OpenSSH。

Does anyone know why this is happenning and how I can get my Windows machine to sucessfully clone from a server to itself?有谁知道为什么会发生这种情况以及如何让我的 Windows 机器成功地从服务器克隆到自身? Thanks!谢谢!

A valid ssh url would be一个有效的 ssh 网址是

auser@myserver-Dell-System

You can check if you can resolve and connect to that server with您可以检查是否可以解析并连接到该服务器

ssh -T auser@myserver-Dell-System

That supposes that you have generated a public/private ssh key pair, and added your public key to ~auser/.ssh/authorized_keys file first.假设您已经生成了一个公钥/私钥 ssh 密钥对,并首先将您的公钥添加到~auser/.ssh/authorized_keys文件中。
See " Adding SSH Keys to authorized_keys "请参阅“将 SSH 密钥添加到 authorized_keys

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

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