git pull
拉取
git pull origin master
master
是要拉取的远程分支的名称。
强制执行并覆盖本地更改。
git fetch origin
git reset --hard origin/master
请注意,这是一个危险的操作,因为它会永久删除本地未提交的更改。
git fetch origin
只会更新默认远程仓库的信息。
git fetch --all
会更新所有配置的远程仓库的信息。
如果出现类似以下报错,是因为Git LFS是用于管理大型文件的扩展,但它可能需要付费或试用企业版才能支持。
Downloading data/ckpt/synthesizer/mandarin/mandarin.pt (526 MB)
Error downloading object: data/ckpt/synthesizer/mandarin/mandarin.pt (6e89b5f): Smudge error: Error downloading data/ckpt/synthesizer/mandarin/mandarin.pt (6e89b5f9a01e79d32e05e6a88c67f5eb26b91924b42dc7200dfd6a07e87a438f): batch response: LFS only supported repository in paid or trial enterprise.
跳过Git LFS下载:如果不需要这些大型文件,可以尝试跳过Git LFS下载并继续执行git reset --hard origin/master
命令。使用以下命令来禁用Git LFS下载:
git config --global filter.lfs.smudge "git-lfs smudge --skip %f"
git config --global filter.lfs.process "git-lfs filter-process --skip"
请注意,跳过Git LFS下载可能会导致某些文件丢失或损坏,具体取决于您的项目和需求。如果这些文件对您的项目很重要,请确保解决Git LFS问题以正确获取这些文件。
git push
上传
git add .
git commit -m "Commit message"
git push -u origin master
强制推送覆盖提交。
git push -f origin 分支名
通常应避免使用强制推送,除非有充分的理由,例如修复尚未推送的先前提交中的错误。