A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© WilliamJiang 初级黑马   /  2019-6-20 23:16  /  872 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

将本地项目推送至GitHub仓库时的大致流程和步骤:
第一步:首先现在GitHub上面新建一个项目,复制该项目的ssh地址,比如
git@github.com:XXX/XXX.git
第二步:在本地项目上 git init 初始化一个仓库,然后 使用
git add .
git commit -m "commit message"
第三步:将本地仓库关联GitHub仓库
git remote add origin[仓库名] git@github.com:XXX/XXX.git
然后 git push -u origin[仓库名] master
这时候可能会遇到如下错误
! [rejected]        master -> master (non-fast-forward)error: failed to push some refs to 'https://github.com/doublnt/robert-learn-python'hint: Updates were rejected because the tip of your current branch is behindhint: 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 pull origin[仓库名] master
但是这时你又会遇到
fatal: refusing to merge unrelated histories
这时你只需要
git pull origin[仓库名] master --allow-unrelated-histories
然后就可以直接 push 了
git push origin[仓库名] master

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马