Git
353 字
2 分钟
--
Git
文章摘要
本文介绍Git LFS安装、代理配置及常用操作,包括连接远程仓库、提交代码、清除记录和版本回退等实用技巧。
LFS安装#
1curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash2apt-get install git-lfs初始化#
设置用户名和密码
1git config --global user.name "xwysyy"2git config --global user.email ""注意,可能存在推送或者拉取失败的情况,需要设置端口代理,这里用的是v2rayN,转发端口为1080
1# 配置代理2git config --global http.proxy 127.0.0.1:108083git config --global https.proxy 127.0.0.1:108084# 查看代理5git config --global --get http.proxy6git config --global --get https.proxy7# 取消代理8git config --global --unset http.proxy9git config --global --unset https.proxy连接远程仓库#
1git remote add origin <....git>查看是否连接
1git remote -vgit pull#
1# 拉取默认分支2git pull3# 或使用带参数 pull, 拉取指定分支4git pull origin mastergit add#
将文件添加到暂存区
1git add <file_name>将所有修改过的文件添加到暂存区
1git add .git commit#
提交暂存区的文件到本地仓库
1git commit -m commit_messagegit push#
1 git push2 # git push origin master清除cache#
1git rm -r --cached .清除git仓库的所有提交记录#
- 创建新分支
1git checkout --orphan newBranch- 添加所有文件(除了.gitignore中声明排除的)
1git add -A- 提交跟踪过的文件(Commit the changes)
1git commit -am init- 删除master分支
1git branch -D master- 重命名当前分支为master
1git branch -m master- 重新指定远端
1git remote add origin "xxx.git"-
已经有了就是git remote set-url origin ..
-
强制提交到远程master分支
1git push -f origin mastergit回退到某个版本#
1git reset --hard <commit>2git push -f -u origin master
最后更新于 2026-01-10
部分内容可能已过时
文章目录
分类
标签
LLM 7 RL 5 Distributed Training 3 GPU 3 MoE 3 Post-Training 3 Scaling Laws 3 Attention 2 GRPO 2 Inference 2 Transformer 2 Benchmark 1 CUDA 1 Data 1 Evaluation 1 Flash Attention 1 Git 1 GPU Kernel 1 Information-Theory 1 KV Cache 1 LaTeX 1 Linux 1 Pre-Training 1 Quantization 1 State Space Models 1 Sublime Text 1 Tokenization 1 Triton 1
© 2026 xwysyy. All Rights Reserved.