美文网首页
Git基本操作和错误

Git基本操作和错误

作者: DavidPei | 来源:发表于2018-07-08 00:40 被阅读0次

创建SSH Key

ssh-keygen -t rsa -C "youremail@example.com"

本地创建仓库操作

  • 创建本地仓库
git init 
  • 将文件添加进Git
git add 文件名  
git add . #将所有的文件全部添加到Git
  • 提交
git commit -m "描述信息"

Git远程仓库操作

  • 查看远程仓库
git remote -v 
  • 添加远程仓库
git remote add 名称 远程仓库地址
git remote add origin git@git.coding.net:pgw1314/shells.git
  • 推送的远程仓库
git push 仓库名  分支
git push origin master 
  • 更新远程仓库
git pull 仓库名 分支
git pull origin master
  • 删除远程仓库
git remote remove 仓库名称

Git常见错误

  • 版本冲突
error: failed to push some refs to 'git@git.coding.net:pgw1314/Documents.git'

解决办法

git pull --rebase origin master

相关文章

网友评论

      本文标题:Git基本操作和错误

      本文链接:https://www.haomeiwen.com/subject/vepnuftx.html