我想在我们公司的本地网络上使用 Git,因为我的计算机无法访问 Internet。我的 friend 有互联网连接和一台 ubuntu 机器,他将一些源代码推送到 Git,我需要在没有互联网连接的情况下 pull 它们,我也使用 ubuntu 14.04。
另外,我使用以下命令设置了一个存储库:
git init --bare
编辑:两台机器都是ubuntu,很抱歉造成误解。
最佳答案
请您的 friend 为 git 存储库创建一个 Windows 共享。
确保您已安装
apt-get install cifs-utils
创建挂载目录
$ mkdir ~/my_friends_repo
使用挂载远程共享
$ sudo mount -t cifs -o username=USERNAME,password=PASSWORD \
//your_friends_ip_or_computer_name/NAME_OF_SHARE ~/my_friends_repo
现在你可以克隆它
git clone ~/my_friends_repo my_friends_repo_clone
或将其作为另一个远程存储库添加到您现有的存储库中并提取他的更改
git remote add my_friends_repo ~/my_friends_repo
git pull my_friends_repo master
关于git - 如何在没有互联网连接的情况下在 ubuntu 上提取 git 存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26157389/