笔者每次新建仓库后首次同步都记不住操作,故干脆开篇博客记录一下

本地仓库首次推送

  1. git init
  2. touch README.md
  3. git add .也可以git remote add origin git@github.com:xxxxx/yyyyy.git
  4. git commit -m "first commit"
  5. git push -u origin master
  6. 如果推送失败,但是上面又没有什么必要的,可以使用强制推送git push -f origin master

删除 github 仓库上的文件夹

  1. git pull orint master将远程仓库拉下来;
  2. dir查看目录;
  3. git rm -r --cached 文件夹名将指定文件夹删除;
  4. git commit -m '删除了XXX文件夹'提交并添加操作说明;
  5. git push -u origin master将本次操作推送到 github 上

遇到的问题

  1. 同步时出现Permanently added the RSA host key for IP address 'xxx.xxx.xxx.xxx' to the list of known host
    这个提示只是一个警告,对实际操作没有影响。若要取消这个提示,只需在 hosts 文件下添加一条记录就可以了:
    sudo vim /etc/hosts
    打开之后,添加xxx.xxx.xxx.xxx github.com,保存并关闭即可

瓦雀