1、git错误提示:writing objects : 值%停住
设置方法: git config --global http.postBuffer 524288000
原因:git上传,限定一次push命令的buffer大小。
2、回退本地commit版本,文件修改不变。 git reset HEAD~
执行一次回退一个commit版本
3、git log
查看当前所有commit版本ID及说明
4、git show
+ commitid 查看某个版本的修改内容,git show commitId fileName
查看某个文件的修改内容
5、其它版本回退:
git reset --soft xxx 文件不会改变,回退到提commit之前
git reset --mixed xxx 文件不会改变,不同的地方也不会提
git reset --hard xxx 表示把分支和头指针指向这个xxx commit,本地仓库暂存区工程区都还原到 xxx 这个commit,这个xxx 之后的提交都被丢弃
git reset --keep xxx 表示把分支和头指针指向这个xxx commit,暂存区工程区都还原到 xxx 这个commit,本地仓库不会变
6、 git reflog 查看命令操作的历史
7、修改.gitignore后不生效 清除缓存:git rm -r --cached .
然后再进行 add commit push
8、修改项目git地址 git remote set-url origin [giturl]
giturl可以是http或者ssh
9、设置ssh密钥,当使用ssh地址时需要在客户端使用ssh-keygen 命令生成 私钥[id_rsa]和公钥[.pub扩展名 id_rsa.pub],生成的文件保存在 ~/.ssh目录下。然后将id_rsa.pub文件内容填写到git服务器端用户设置面板中。即可正常使用ssh地址clone、push
10、重置系统中保存的默认git推送账号密码:
git config --system --unset credential.helper
git config --global credential.helper store
git config --local --unset credential.helper
git config --global credential.helper cache //改回不用每次都输入密码
11、当某一个仓库历史太多的时候,git clone很慢,甚至会卡在 remote: Compressing objects: 78% (3483/4465)
很久。或者克隆失败。这个时候可以使用depth=1来只克隆最新的commit,速度就会快很多。【出现这种原因也有可能是以前版本提交过大文件,虽然后边已经删除,但是记录中还有】git clone --depth=1 https://git.huizhouyiren.com/lo/http-api.git
12、git账号原来保存的密码错误等会导致一些错误比如:
XXXXX/info/refs not valid: is this a git repository
重置密码比较简单的办法
git config --global --edit
把里边的 user store 都删除掉再保存重新push就会要求输入密码
13、git创建发布版本
创建release版本git checkout -b release/v1.1
创建版本标签git tag -a v1.1 -m "1.1版本"
推送版本git push origin release/v1.1
切换回主分支git checkout main
查看当前分支git branch
切换到发布分支git checkout -b release/v1.1
(๑>ڡ<)☆谢谢老板~
使用微信扫描二维码完成支付
