Git 全局设置: git config --global user.name "少杰" git config --global user.email "shaojie@ui.cn" 创建 git 仓库: mkdir uxpen cd uxpen git init touch README.md git add README.md git commit -m "first commit" git remote add origin https://gitee.com/uishaojie_admin/uxpen.git git push -u origin "master" 已有仓库? cd existing_git_repo git remote add origin https://gitee.com/uishaojie_admin/uxpen.git git push -u origin "master" 报错 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仓库的文件,再进行推 第二种强制推送并且覆盖远程git仓库:git push -f origin master 注意:千万不要用:git pull --rebase origin master这个命令,这个命令,拉远程git仓库文件,并且覆盖本地文件。因此就会把我们本地还没有上传git的文件给覆盖掉,我们本地写的东西就没了