git相关

220 阅读1分钟

当使用gitlab上传代码的时候报错fatal: unable to access 'github.com

尝试敲入命令行

git config --global http.sslVerify false 

回退版本

git reset --hard commit_id

  • HEAD指向的版本就是当前版本,因此,Git允许我们在版本的历史之间穿梭,使用命令git reset --hard commit_id

  • 穿梭前,用git log可以查看提交历史,以便确定要回退到哪个版本。

  • 要重返未来,用git reflog查看命令历史,以便确定要回到未来的哪个版本。

gitLab上新建仓库后和本地仓库关联步骤:

git remote -v  查看源仓库

git remote rm origin  删除源仓库

git remote add origin 139.xx.xx.81:8880/renw/duibia… 添加

git pull --allow-unrelated-histories  加上这个就和远程仓库关联了并且可以推送了