为什么我无法克隆 git 存储库?
Why I failed to clone a git repository?
我在 win7 64 位中使用 Git Bash 2.9.0-64 位。
我在家里自己的电脑上创建了一个 git 存储库 'learnshell',并将其推送到 GitHub。
然后,我想把learnshell克隆到我公司的电脑上。
但是我失败了,目录是 ~/home,它不是 git 存储库,这是我的命令
git clone https:github.com/myname/learnshell.git
这是相应的结果:
Cloning into 'learnshell' ...
ssh: Could not resolve hostname https:Name or service not known
Fatal: Coule not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
我没有使用 ssh,因为我公司的网络不支持它。
为了解决这个问题,我更改了目录并创建了一个名为 'learnshell' 的 git 存储库。之后,我首先 运行 命令
git remote add origin git@github.com:myname/learnshell.git
,
然后我运行
git clone https://github.com/myname/learnshell
.
这次克隆成功了
有趣的是,在我将目录更改回 ~/home 和 运行 克隆命令后,它也成功了。
我不知道这个 phenomenon.So 下面到底发生了什么,哪个 git 命令使克隆从失败到成功?
准备打脸
git clone https://github.com/myname/learnshell.git
您忘记了斜杠。
错误 "Could not resolve hostname" 表示使用 DNS 时出现问题。将域 "github.com" 转换为 IP 地址时出现问题。显然,这是一个网络(配置)问题。
因为您发布的命令不影响网络,在我看来,您输入其他命令时问题已自行解决。尝试通过网络浏览器连接到 github.com 在当时是一个有用的测试。
我在 win7 64 位中使用 Git Bash 2.9.0-64 位。
我在家里自己的电脑上创建了一个 git 存储库 'learnshell',并将其推送到 GitHub。 然后,我想把learnshell克隆到我公司的电脑上。
但是我失败了,目录是 ~/home,它不是 git 存储库,这是我的命令
git clone https:github.com/myname/learnshell.git
这是相应的结果:
Cloning into 'learnshell' ...
ssh: Could not resolve hostname https:Name or service not known
Fatal: Coule not read from remote repository.Please make sure you have the correct access rights and the repository exists.
我没有使用 ssh,因为我公司的网络不支持它。
为了解决这个问题,我更改了目录并创建了一个名为 'learnshell' 的 git 存储库。之后,我首先 运行 命令
git remote add origin git@github.com:myname/learnshell.git
,
然后我运行
git clone https://github.com/myname/learnshell
.
这次克隆成功了
有趣的是,在我将目录更改回 ~/home 和 运行 克隆命令后,它也成功了。
我不知道这个 phenomenon.So 下面到底发生了什么,哪个 git 命令使克隆从失败到成功?
准备打脸
git clone https://github.com/myname/learnshell.git
您忘记了斜杠。
错误 "Could not resolve hostname" 表示使用 DNS 时出现问题。将域 "github.com" 转换为 IP 地址时出现问题。显然,这是一个网络(配置)问题。
因为您发布的命令不影响网络,在我看来,您输入其他命令时问题已自行解决。尝试通过网络浏览器连接到 github.com 在当时是一个有用的测试。