新建工程发布到github

1、工程目录下git init
2、git add .
3、git commit
4、建立github库,名称为:platform,得到库地址: https://github.com/gosenkle/platform.git
此时协议等信息都选择为none,保持整个工程为空的,否则无法从本地库上传。
5、关联库地址
git remote add origin https://github.com/gosenkle/platform.git
6、推送到github上
git push -u origin master
-u:初始化时因为内容是空,所以需要需要-u参数;后续可以省略
7、如果在建立github库时因为建立了如readme以及协议等信息,导致远程库并不是空的库,执行6时会发生如下错误
error: failed to push some refs to https://github.com/gosenkle/platform.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., '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
8、执行如下命令git pull origin master --allow-unrelated-histories,成功,后续可以执行6操作了。

9、创建本地分支并同步到远程库
1)本地执行git branch release
2)切换分支 git checkout release
3)将分支放到远程库:git push origin release


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值