目录

怎么把开源项目放到自己的github,gitee,gitea上

怎么把开源项目放到自己的github,gitee,gitea上

一、创建仓库(大部分可以不填)

https://i-blog.csdnimg.cn/blog_migrate/0c02a0229848505ffcca90c1d600f9df.png

二、删除.git文件夹

https://i-blog.csdnimg.cn/blog_migrate/c24d7f98aaf317efa520abc971b0ee1c.png

三、执行初始化命令(初始出.git文件夹)

在本地项目下执行命令

https://i-blog.csdnimg.cn/blog_migrate/ce53b3749c6e9b6d68b11c4eb4d55ae5.png

git init

四、与远程仓库建立关系

git remote add origin ssh://git@xx.xx.xx.xx:61022/shengbaitong/inst_ops1.git

五、添加文件

如果是第一次用这台电脑在这三个平台新建仓库。这一步是必须得,因为你必须得把文件添加并提交进去,不然最后合并时会报错

git add .

六、提交

git commit -m "第一次提交"

七、合并(看自己建立的分支是啥)

git push -u origin main/master

八、新平台新仓库第一次提交会输入用户名密码

如果密码错误,自己去控制面板——账户——windows凭据修改

https://i-blog.csdnimg.cn/blog_migrate/fe1283b898f635af7fec9520efa8c0bb.png

九、相关报错

1、执行git push -u origin main/master报错

error: src refspec main does not match any error: failed to push some refs to “”

error: src refspec main does not match any error: failed to push some refs to “”

1、原因可能就是第一次在新电脑提交代码

2、github 的默认master分支已经悄悄的变为main分支了