因此,我想将大文件本地存储在备份硬盘驱动器上,而不是将它们推送到远程服务器并存储在其中。我基本上希望备份硬盘充当远程服务器。
我尝试过这样做:
git config lfs.storage /absolute/path/to/local/storage
但是,当我将更改推送到远程存储库时,它似乎正在尝试上传到远程服务器,并且出现此错误:
批量响应:此存储库超出其数据配额。负责LFS带宽的账户应购买更多数据包以恢复访问。
无法将一些参考推送到“https://github.com/user/repoGitLTF.git”
我并不是试图将它们上传到远程服务器,只是将它们保存在本地备份硬盘上(与本地存储库的位置不同),但否则将所有其他更改推送到远程存储库。
关于如何实现这一目标有什么想法吗?
从错误消息来看,您在推送更改时使用的遥控器仍然指向 GitHub 上的存储库,地址为
https://github.com/user/repoGitLTF.git
。您需要更新遥控器或创建一个新遥控器指向硬盘上的存储库。
假设您的遥控器名为 origin,只需输入:
# update the url of your remote
git remote set-url origin /absolute/path/to/local/storage
# alternatively, create a second new remote for your hard drive
git remote add harddrive /absolute/path/to/local/storage
在第二种情况下,如果您创建一个新的遥控器,您就可以将更改推送到 GitHub 上的旧存储库,并将新存储库推送到硬盘上。
# pushing changes to the repo on GitHub
git push origin my_branch
# pushing changes to the repo on the hard drive
git push harddrive my_branch
为了完整起见,如果您尝试将更改推送到不是 git 存储库的本地文件夹,您首先需要对其进行初始化。由于您的存储库将充当远程收集更改的角色,因此最好将其初始化为裸存储库。
# cd-ing into the desired folder
cd /absolute/path/to/local/storage
# initializing the folder as a bare repository
git init --bare