Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows Git存储库未更新_Windows_Git_Ubuntu - Fatal编程技术网

Windows Git存储库未更新

Windows Git存储库未更新,windows,git,ubuntu,Windows,Git,Ubuntu,背景: 在一个网络中,有两台电脑,一台使用Windows7,另一台使用Ubuntu12.10作为操作系统 两者都安装了Git。Windows one from和Ubuntu one fromapt get install git core Ubuntu PC配置了Samba,因此可以使用其主机名访问网络中的Windows PC 使用git克隆http://windowspc/system/.git,可以从Ubuntu PC中的Windows PC创建存储库的克隆 问题: 在Windows

背景:

  • 在一个网络中,有两台电脑,一台使用Windows7,另一台使用Ubuntu12.10作为操作系统
  • 两者都安装了Git。Windows one from和Ubuntu one from
    apt get install git core
  • Ubuntu PC配置了Samba,因此可以使用其主机名访问网络中的Windows PC
  • 使用
    git克隆http://windowspc/system/.git
    ,可以从Ubuntu PC中的Windows PC创建存储库的克隆
问题:

  • 在Windows PC中对代码进行更改。命令
    git add.
    git commit-m“Comment.
    在Windows PC的git提示符中发出
  • 回到Ubuntu PC,当出现
    git fetch
    git pull
    命令时,会显示消息
    已经是最新的
  • 但是,在Windows PC中所做的任何更改都不会出现在Ubuntu PC中
问题

  • 从Windows PC到Ubuntu PC更新文件的路径应该是什么

我习惯于在完成提交后进行“git推送”

我将创建一个由windows机器和Ubuntu机器共享的裸存储库。然后,我会修改您的说明,在您提交更改后加入“git推送”。然后可以使用gitk确保所有内容都是最新的。顺便说一句,我发现在Windows下访问git的最佳方法是使用cygwin

我创建在Windows和Unix/Linux之间共享的裸存储库的方法是:

cd /cygdrive/c/source
git clone --bare --no-hardlinks -l . /cygdrive/s/shareddir/source.git
要将新的裸存储库连接回原始源代码,请执行以下操作:

cd /cygdrive/c/source
git remote add origin /cygdrive/s/shareddir/source.git
git remote update
git remote -v
git branch --set-upstream master origin/master

尝试克隆
http://windowspc/system
(没有
.git
)@VonC:我试过了。但它至少赢得了克隆,更不用说更新了。要制作一个克隆,我们必须使用
.git
。两个存储库的分支是否相同?@rlegendi:Ubuntu PC中的存储库是Windows PC中的存储库的克隆。两个存储库只有一个分支(我仍在尝试设置),即“主”。您确定没有使用硬链接,因为所有存储库实际上都是指向同一git存储库的链接。确保克隆时没有硬链接。如果这有帮助,请分离您的存储库,这样您就有了一个核心裸存储库,因为它更灵活。(见下面我的答案)。