gpt4 book ai didi

windows - Git 仓库没有更新

转载 作者:可可西里 更新时间:2023-11-01 10:48:48 25 4
gpt4 key购买 nike

背景:

  • 在一个网络中,有两台 PC,一台使用 Windows 7,另一台使用 Ubuntu 12.10 作为操作系统。
  • 两人都安装了 Git。 Windows 一个来自 http://git-scm.com/download/win和 Ubuntu 一个来自 apt-get install git-core
  • Ubuntu PC 配置了 Samba,因此可以使用主机名访问网络中的 Windows PC。
  • 使用 git clone http://windowspc/system/.git,可以在 Ubuntu PC 中从 Windows PC 创建存储库的克隆。

问题:

  • 对 Windows PC 中的代码进行了更改。命令 git add .git commit -m"Comment." 在 Windows PC 的 Git 提示符下发出。
  • 回到 Ubuntu PC 中,当 git fetchgit pull 命令出现问题时,会显示消息 Already up-to-date
  • 但是,在 Windows PC 中所做的任何更改都不会出现在 Ubuntu PC 中。

问题

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

最佳答案

我习惯于在提交后执行“git push”。

我会创建一个由您的 Windows 机器和 Ubuntu 机器共享的裸存储库。在您提交更改后,我会修改您的说明以包含“git push”。然后你可以使用 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

关于windows - Git 仓库没有更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13047089/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com