我怎样才能从另一台机器'git clone'? [英] How can I 'git clone' from another machine?
本文介绍了我怎样才能从另一台机器'git clone'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一台机器上(IP地址192.168.1.2),我创建了一个Git仓库,它由
$ cd / home / hap / working
$ git init
$(添加一些文件)
$ git add。
$ git commit -m'初始提交'
我还有另一台机器Wi-Fi网络。如何从另一台机器上获得克隆?
解决方案
您需要使用git + ssh URL 来执行Git克隆:
git clone git + ssh://hap@192.168.1.2/~/working
打破它:
-
git + ssh
告诉Git你想使用ssh连接到Git仓库。 -
hap
是您的用户名(我假设您的问题是基于主目录) li>
-
192.168.1.2
是您要连接的机器 -
〜/ working
是远程机器上Git仓库的路径(所以〜
就是你的主目录)
其他一些注意事项:
- 您需要有一个ssh服务器使用Git存储库启用服务器
- 您需要知道用户的密码
hap
On one machine (IP address 192.168.1.2), I create a Git repository by
$ cd /home/hap/working
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
And I have another machine on the same Wi-Fi network. How can I get clone from the other machine?
解决方案
You need to use a git+ssh URL to perform the Git cloning:
git clone git+ssh://hap@192.168.1.2/~/working
To break it down:
git+ssh
tells Git that you want to use ssh to connect to the Git repository.hap
is your username (I assume based on the home directory in your question).192.168.1.2
is the machine that you want to connect to~/working
is the path to your Git repository on the remote machine (so~
is your home directory)
Some other things to note:
- You need to have a ssh server enabled on the machine with the Git repository
- You'll need to know the password for the user
hap
这篇关于我怎样才能从另一台机器'git clone'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文