已有项目代码首次git上传到仓库操作步骤

1.初始化仓库

git init

2.关联仓库

git remote add origin <仓库ssh地址>

3.新建并选择新的本地分支(与远程分支一致)

git checkout -b 分支名称(一般是main或者master,优先使用master)

4.添加全部文件(第一次push代码之后,从第二次开始就不要再搞前面的了,之前已经绑定过了)

git add .

5.提交信息

git commit -m "备注信息"

6.强制推送

git push -f origin 分支名称

如果不幸遇到这种恶心的问题:

admin@DESKTOP-TNI5ROV MINGW64 /d/git/rt-thread/rt-thread_pm2
$ git log
fatal: detected dubious ownership in repository at 'D:/git/rt-thread/rt-thread_pm2'
'D:/git/rt-thread/rt-thread_pm2' is owned by:
        'S-1-5-21-1045045257-1974506225-3199486363-500'
but the current user is:
        'S-1-5-21-1045045257-1974506225-3199486363-1001'
To add an exception for this directory, call:
        git config --global --add safe.directory D:/git/rt-thread/rt-thread_pm2

请参考:
https://blog.csdn.net/tcjy1000/article/details/127129224?login=from_csdn

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WiFiMing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值