当前位置: 首页 > article >正文

初始本地仓库推送到远程仓库-git

背景(问题描述)

下面的git的操作符合的情况是:

  • ①本地初始化一个仓库,但是还没有和远程仓库相关联;

  • ②远程仓库也刚刚创建,里面啥也没有

然后目前就想将本地的仓库的内容和远程仓库相关联并推送到远程仓库里面。

1、初始化:

86189@LAPTOP-GAHM48A0 MINGW64 /d/start_java/XinQiUtilsOrDemo/restTemplateDemo
$ git init
Initialized empty Git repository in D:/start_java/XinQiUtilsOrDemo/restTemplateDemo/.git/

86189@LAPTOP-GAHM48A0 MINGW64 /d/start_java/XinQiUtilsOrDemo/restTemplateDemo (master)
$ git add .
warning: in the working copy of 'SimpleRestTemplateProject/moduleOne/pom.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'SimpleRestTemplateProject/moduleSecond/pom.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'SimpleRestTemplateProject/pom.xml', LF will be replaced by CRLF the next time Git touches it

86189@LAPTOP-GAHM48A0 MINGW64 /d/start_java/XinQiUtilsOrDemo/restTemplateDemo (master)
$ git commit -m "add easy demo"
[master (root-commit) ba705e9] add easy demo
 11 files changed, 263 insertions(+)
 create mode 100644 SimpleRestTemplateProject/README.md
 create mode 100644 SimpleRestTemplateProject/moduleOne/pom.xml
 create mode 100644 SimpleRestTemplateProject/moduleOne/src/main/java/com/xinqi/xinqidev/ModuleOneApplication.java
 create mode 100644 SimpleRestTemplateProject/moduleOne/src/main/java/com/xinqi/xinqidev/config/RestTemplateConfiguration.java
 create mode 100644 SimpleRestTemplateProject/moduleOne/src/main/java/com/xinqi/xinqidev/controller/HelloController.java
 create mode 100644 SimpleRestTemplateProject/moduleOne/src/main/resources/application.yml
 create mode 100644 SimpleRestTemplateProject/moduleSecond/pom.xml
 create mode 100644 SimpleRestTemplateProject/moduleSecond/src/main/java/com/xinqi/xinqidev/ModuleSecondApplication.java
 create mode 100644 SimpleRestTemplateProject/moduleSecond/src/main/java/com/xinqi/xinqidev/controller/HelloController.java
 create mode 100644 SimpleRestTemplateProject/moduleSecond/src/main/resources/application.yml
 create mode 100644 SimpleRestTemplateProject/pom.xml



2、配置并推送到最新仓库

86189@LAPTOP-GAHM48A0 MINGW64 /d/start_java/XinQiUtilsOrDemo/restTemplateDemo (master)
$ git remote add origin git@gitee.com:flowers-bloom-is-the-sea/rest-template-demo.git

86189@LAPTOP-GAHM48A0 MINGW64 /d/start_java/XinQiUtilsOrDemo/restTemplateDemo (master)
$ git pull origin master --allow-unrelated-histories
From gitee.com:flowers-bloom-is-the-sea/rest-template-demo
 * branch            master     -> FETCH_HEAD
Merge made by the 'ort' strategy.
 README.en.md | 36 ++++++++++++++++++++++++++++++++++++
 README.md    | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 README.en.md
 create mode 100644 README.md

86189@LAPTOP-GAHM48A0 MINGW64 /d/start_java/XinQiUtilsOrDemo/restTemplateDemo (master)
$ git push -u origin master
Enumerating objects: 36, done.
Counting objects: 100% (36/36), done.
Delta compression using up to 8 threads
Compressing objects: 100% (23/23), done.
Writing objects: 100% (35/35), 4.40 KiB | 644.00 KiB/s, done.
Total 35 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To gitee.com:flowers-bloom-is-the-sea/rest-template-demo.git
   a083ace..3fdcf23  master -> master
branch 'master' set up to track 'origin/master'.

3、小结:

git init
git add .
git commit -m "first commit"
git remote add origin git_url
git pull origin master --allow-unrelated-histories
git push -u origin master

http://www.kler.cn/a/149620.html

相关文章:

  • 2024 kali操作系统安装Docker步骤
  • 【Qt】在 Qt Creator 中使用图片资源方法(含素材网站推荐)
  • 扫雷游戏代码分享(c基础)
  • Matlab实现鹈鹕优化算法(POA)求解路径规划问题
  • Ubuntu 的 ROS 操作系统turtlebot3环境搭建
  • 【C/C++】CreateThread 与 _beginthreadex, 应该使用哪一个?为什么?
  • 如何在自定义数据集上训练 YOLOv8 实例分割模型
  • Spring的@Feign源码分析
  • 【解决】HDFS JournalNode启动慢问题排查
  • SpringCloud之服务网关Gateway组件使用——详解
  • uniapp+微信小程序监听返回事件
  • Postman进阶功能实战演练
  • Vue框架学习笔记——计算属性
  • C++内存管理
  • 西南科技大学信号与系统A实验三(线性连续时间系统的分析)
  • 前后端分离前端请求后端接口的方式
  • 正向和反向代理区别
  • STM32 基础知识
  • 查看各ip下的连接数
  • 第一个php扩展开发的demo
  • 模拟实现offsetof宏(详解)
  • 第三方发起备份的ORA-00245问题
  • vue实现动态路由菜单!!!
  • 19. Python 数据处理之 Pandas
  • 奇葩问题:arp缓存与ip地址冲突(实际是ip地址被占用导致arp缓存出现问题)
  • ssh管理