【git】远程推送

独自空忆成欢 提交于 2020-01-24 21:38:36
  1. git config --global user.email “you@example.com”
    git config --global user.name “Your Name”

  2. git init

  3. git status

  4. git add .

  5. git status

  6. git commit -am “first commit”

  7. git remote add origin git@github.com:williamdsy/mmall_learning.git

  8. git branch

  9. git pull

报错:git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解决方法:ssh-keygen失效,重新设置ssh-keygen
  1. ssh-keygen -t rsa -C “you@example.com”
三次enter,编辑器打开 C:\Users\williamdsy/.ssh/id_rsa.pub
复制全部,粘贴到github.com中
  1. git pull
  2. git push -u origin master
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:williamdsy/mmall_learning.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 原因是当前推送的分子落后了,强制推送:git push -u -f origin master
  1. git branch
  2. git branch -r
  3. 分支开发,主干发布
  4. git checkout -b v1.0 origin/master 创建分支
  5. git branch 检查当前分支
  6. git push origin HEAD -u -f 把分支推送到远程,到github.com 上查看,推送成功
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!