我在Ubuntu机器上编程,并希望在我的Mac上进行备份。
从 Mac 登录 Ubuntu 使用
ssh myubuntu@xx.dyndns.org
工作正常。
这就是我想在我的Mac上做的事情(将.c文件添加到Mac git):
git add myubuntu@xx.dyndns.org/home/myubuntu/Documents/*.c
git commit -am 'myproj'
但是第一个命令会导致错误:
fatal: pathspec ‘myubuntu@xx.dyndns.org/home/myubuntu/Documents/*.c’ did not match any files
我应该如何改写 git add 命令?
假设你的Mac上已经安装了Git,并且Ubuntu机器的git存储库植根于/home/myubuntu/Documents
git clone myubuntu@xx.dyndns.org:/home/myubuntu/Documents myproj
然后,每次您要备份到Mac时,只需在Mac上执行git pull
即可。
如果您尚未将 Ubuntu 文件放入 Git,请在该计算机上执行以下操作:
cd /home/myubuntu/Documents
git init
git add .
git commit
仅供参考,这会将所有子文件夹中的所有文件添加到存储库中,这可能不是您想要的。