gitee本地项目上传

1.先生成SSH密钥

复制代码
ssh-keygen -t rsa -C "trueelegance@163.com"

2.gitee配置公钥,设置对应的公钥名称比如:localtest;

Git 全局设置:若刚安装完Git,需要进行Git的配置【若已配置完成,此步骤可以跳过】

复制代码
git config --global user.name "zhenwodefengcai"
git config --global user.email "trueelegance@163.com"

3.使用如下命令查看是否创建成功

  • git config --list

    解决输入 git config --list 退出的问题

    输入git config --list 最后出现一个 (END) ,要等一会才能退出来,这个怎么解决?

    原因: git日志过多最后显示end无法输入命令,打印的信息是全部用户配置的,表示可以用了。

    直接按 q (或+Enter) , 即可退出; 或

    退出这个界面重新进入即可。

4.创建 git 仓库:在文件夹内输入命令,生成.git文件夹在文件夹内;

复制代码
git init 

5.通过 git status 来查看能被上传的文件

6.查看关联的远程仓库:

git remote -v

origin https://gitee.com/zhenwodefengcai/localtest.git (fetch)

origin https://gitee.com/zhenwodefengcai/localtest.git (push)

7.关联远程库:

复制代码
git remote add origin https://gitee.com/zhenwodefengcai/localtest.git

提示:git remote add origin https://gitee.com/zhenwodefengcai/localtest.git error: remote origin already exists.

解决办法:

执行以下操作即可: 7.1、git remote -v 查看项目关联的远程库地址

git remote -v origin https://gitee.com/zhenwodefengcai/localtest.git (fetch) origin https://gitee.com/zhenwodefengcai/localtest.git (push)

7.2、先输入git remote rm origin 删除关联的 origin 的远程库

git remote rm origin

7.3、关联自己的仓库 git remote add origin https://gitee.com/xxxxxx.git

git remote add origin https://gitee.com/zhenwodefengcai/localtest.git

7.4.推送前先关联远程仓库:

git pull origin master --allow-unrelated-histories

7.5.出现了如下的错误:git pull origin master --allow-unrelated-histories fatal: couldn't find remote ref master;

7.6.解决办法:

git pull --rebase origin master

git push origin master

8.执行git add .将所有文件添加到暂存区 . 表示添加所有文件

9.执行git commit -m '本次提交备注message'

10.执行 git remote add origin https://gitee.com/blanhb/my_ruoyi.git关联远程仓库;

这个命令在前面关联也可以的;这里后面关联也行的;

11.执行git pull origin master 拉取合并远程仓库代码

12.这个错误通常是由于两个不同的 Git 仓库历史不相关导致的。如果你执行 git pull 命令,Git 会尝试将远程仓库的更改合并到本地仓库。但是如果本地仓库和远程仓库的历史记录不同,Git 就会拒绝合并操作。 你可以尝试使用 --allow-unrelated-histories 选项进行合并,例如:

git pull origin master --allow-unrelated-histories;

这里执行完命令会有这个窗口,输入:q退出

13.执行git push -u origin master将本地代码推送到远程仓库

14.远程仓库查看提交的代码,代码有了;

15.最后,我们后续就可以正常的在idea中进行git的一些常规操作了,comiit,pull,push等。

相关推荐
liliangcsdn40 分钟前
如何使用elasticdump进行elasticsearch数据还原
大数据·elasticsearch·搜索引擎
yumgpkpm2 小时前
Doris 并入CMP7(类Cloudera CDP 7.3.1 404华为鲲鹏ARM版)的方案和实施源代码
大数据·oracle·sqlite·sqoop·milvus·cloudera
yumgpkpm2 小时前
Doris在CMP7(类Cloudera CDP 7 404版华为Kunpeng)启用 Kerberos部署Doris
大数据·hive·hadoop·python·oracle·flink·cloudera
YangYang9YangYan2 小时前
高职大数据技术专业学习与发展指南
大数据·人工智能·学习·数据分析
汤姆yu2 小时前
基于大数据的天气分析与应用系统
大数据
悦光阴3 小时前
SQL Server 并发控制:Fabric Warehouse只支持快照隔离
大数据·运维·数据库·fabric
lijun_xiao20094 小时前
elasticsearch学习笔记-02
笔记·学习·elasticsearch
DolphinScheduler社区4 小时前
Apache DolphinScheduler 3.3.2 正式发布!性能与稳定性有重要更新
大数据·开源·apache·任务调度·海豚调度·发版
SeaTunnel4 小时前
Apache SeaTunnel 支持 Metalake 开发了!避免任务配置敏感信息暴露
大数据·开源·apache·个人开发·数据集成·seatunnel·看开源之夏
飞雁科技4 小时前
CRM客户管理系统定制开发:如何精准满足企业需求并提升效率?
大数据·运维·人工智能·devops·驻场开发