GitLab本地、远程更新已经fork的项目
单用IDEA无法做到,必须配合使用Git命令行才能做到,而且是先从原作者项目更新本地库,再从本地库push到自己远程fork项目,非常坑逼。
1.到项目clone的根目录右键Git Bash,先查看远程源,一般只有你自己fork项目的源,没有原作者的,需要添加远程源:
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote -v
origin http://172.16.175.36:180/baigang/sunfield-microframe-service.git (fetch)
origin http://172.16.175.36:180/baigang/sunfield-microframe-service.git (push)
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote add upstream ssh://git@172.16.175.36:4422/jiaoma/sunfield-microframe-service.git
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote -v
origin http://172.16.175.36:180/baigang/sunfield-microframe-service.git (fetch)
origin http://172.16.175.36:180/baigang/sunfield-microframe-service.git (push)
upstream ssh://git@172.16.175.36:4422/jiaoma/sunfield-microframe-service.git (fetch)
upstream ssh://git@172.16.175.36:4422/jiaoma/sunfield-microframe-service.git (push)
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git fetch upstream
The authenticity of host '[172.16.175.36]:4422 ([172.16.175.36]:4422)' can't beestablished.
ECDSA key fingerprint is SHA256:hFUMVxu5yYzhamirMDGSsvo3KbgbsVBQ3ZPTOBUIdqs.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
2.这里添加了原作者ssh协议的源,因为没有本机证书,无法连接成功,所以需要改为添加http协议源,这里本公司GitLab服务器需要带上180端口:
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote add upstream http://172.16.175.36:180/jiaoma/sunfield-microframe-service.git
fatal: remote upstream already exists.
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote remove upstream
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote add upstream http://172.16.175.36:180/jiaoma/sunfield-microframe-service.git
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git remote -v
origin http://172.16.175.36:180/baigang/sunfield-microframe-service.git (fetch)
origin http://172.16.175.36:180/baigang/sunfield-microframe-service.git (push)
upstream http://172.16.175.36:180/jiaoma/sunfield-microframe-service.git(fetch)
upstream http://172.16.175.36:180/jiaoma/sunfield-microframe-service.git(push)
这里需要先使用git remote remove命令移除此前错误添加的同名源(其实起别的名也可以,fetch时从正确名字的源获取即可)
3.从添加的原作者源fetch到本地仓库,合并到本地仓库:
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git fetch upstream
remote: Counting objects: 103, done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 103 (delta 24), reused 30 (delta 4)
Receiving objects: 100% (103/103), 12.50 KiB | 914.00 KiB/s, done.
Resolving deltas: 100% (24/24), completed with 6 local objects.
From http://172.16.175.36:180/jiaoma/sunfield-microframe-service
* [new branch] master -> upstream/master
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git merge upstream/master
Updating 2970d82..27ca203
Fast-forward
pom.xml | 58 ++------
.../microframe/common/config/RedisConfig.java | 52 +++++++
.../microframe/common/redis/RedisBaseTemplate.java | 139 ++++++++++++++++++
.../microframe/common/redis/RedisHashTemplate.java | 157 +++++++++++++++++++++
.../microframe/common/redis/RedisListTemplate.java | 130 +++++++++++++++++
.../microframe/common/redis/RedisSetTemplate.java | 110 +++++++++++++++
.../microframe/provider/MUsersSqlProvider.java | 29 ++--
.../com/sunfield/microframe/rest/MUsersRest.java | 82 ++++++++++-
.../sunfield/microframe/service/MUsersService.java | 73 ++++++++++
src/main/resources/application.properties | 52 ++++---
10 files changed, 804 insertions(+), 78 deletions(-)
create mode 100644 src/main/java/com/sunfield/microframe/common/config/RedisConfig.java
create mode 100644 src/main/java/com/sunfield/microframe/common/redis/RedisBaseTemplate.java
create mode 100644 src/main/java/com/sunfield/microframe/common/redis/RedisHashTemplate.java
create mode 100644 src/main/java/com/sunfield/microframe/common/redis/RedisListTemplate.java
create mode 100644 src/main/java/com/sunfield/microframe/common/redis/RedisSetTemplate.java
create mode 100644 src/main/java/com/sunfield/microframe/service/MUsersService.java
4.把更新push到自己远程fork库:
Administrator@admin-PC MINGW64 /e/git_projects/sunfield-microframe-service (master)
$ git push
Enumerating objects: 119, done.
Counting objects: 100% (119/119), done.
Delta compression using up to 8 threads
Compressing objects: 100% (45/45), done.
Writing objects: 100% (103/103), 12.50 KiB | 2.50 MiB/s, done.
Total 103 (delta 24), reused 103 (delta 24)
remote: Resolving deltas: 100% (24/24), completed with 6 local objects.
To http://172.16.175.36:180/baigang/sunfield-microframe-service.git
2970d82..27ca203 master -> master
注意这里应push到自己的远程库,而不是原作者的!
也可使用命令:
git push origin master
这样成功更新了自己本地库、远程fork库,完全不需要IDEA操作了。
参考博客:
https://blog.csdn.net/define_LIN/article/details/81044421
https://www.jianshu.com/p/83be892368d8
https://blog.csdn.net/qq_38835878/article/details/81195400
https://www.zhihu.com/question/20393785/answer/30725725
https://www.cnblogs.com/dinphy/p/6409132.html
切换分支和push到fork库:
https://www.jianshu.com/p/29775d91f536
删除远程源:
https://www.cnblogs.com/BHfeimao/p/6496877.html
GitLab本地、远程更新已经fork的项目的更多相关文章
- GitHub更新自己Fork的项目
转自:http://www.tuicool.com/articles/MzMJre github上有个功能叫fork,可以将别人的工程复制到自己账号下.这个功能很方便,但其有一个缺点是:当源项目更新后 ...
- GitHub更新已经fork的项目
clone 自己的 fork 分支到本地 可以直接使用 GitHub 客户端,clone 到本地,如果使用命令行,命令为: $ git clone git@github.com:morethink/g ...
- github上fork原项目,如何将本地仓库代码更新到最新版本?
场景: 在github上fork原项目,项目组成员发起pull request提交了代码,这时自己在本地仓库该如何更新到最新代码? 操作方法如下: 方法一.从github上进行操作然后更新 登录自己的 ...
- 本地Git连接GitLab(服务器)远程仓库
1.简介 远程仓库是指托管在网络上的项目仓库,现在互联网上有很多项目托管平台,比如github.gitlab等.为了不公开自己项目代码,可以在自己的服务器上搭建自己的项目仓库,最常见的是搭建GitLa ...
- github上fork的项目,如何同步原作者更新的内容?
一.引言 我在github上fork了一个项目,之后原作者又更新了内容,我想把原作者更新的内容同步到我fork的项目仓库中.在此记录一下同步步骤. 二.同步步骤 打开fork的项目的主页,点击Ne ...
- 【转】github更新自己Fork的代码
github更新自己Fork的代码 时间 2014-03-02 23:25:55 micmiu - 软件开发 原文 http://www.micmiu.com/software/build/git ...
- 在github fork的项目中推送与抓取
github -- fork提交项目:自己的仓库和原仓库进行Git同步的操作. 1. 获取你fork的原仓库的更新过的最新代码:如果没有远程原始分支则需要增加. git remote add upst ...
- Github fork其他项目的分支与主干保持同步
Fork一个Repo Fork是一个复制的操作,当你Fork一个项目之后,你就有了在原项目的基础之上进行修改和扩展的权限. 通常情况下,Fork操作用于参与别人的项目(成为项目中的一员),或者以别人的 ...
- github如何实现fork的项目与原项目同步
refer to https://www.jianshu.com/p/fede3333205f 作者:hitchc 链接:https://www.jianshu.com/p/fede3333205f ...
随机推荐
- mysql查询两个日期之前相隔的天数
select timestampdiff(SECOND,'2011-09-25 23:23:13','2011-09-26 22:23:11'); 其中SECOND同样可以改为HOUR,MINUTE
- Spring Boot(一):环境搭建,建立简单项目
一.基本环境搭建 1.下载IntelliJ IDEA :http://www.jetbrains.com/idea/ 2.拖到页面最下面下载旗舰版 3.新建项目 4.设置本地Maven 5.删除多于文 ...
- SQL对照LinQ的基本语句
查询全表: string sql = "SELECT * FROM UserInfo"; var lamAll = db.UserInfo; var LinAll = from u ...
- java生成二维码的几个方法
1: 使用SwetakeQRCode在Java项目中生成二维码 http://swetake.com/qr/ 下载地址 或着http://sourceforge.jp/projects/qrcode/ ...
- virtual dom 简单了解
管理应用程序状态和用户界面的同步一直是前端UI开发复杂性的主要来源.目前出现了不同的方式来处理这个问题.本文简单讨论其中一种方式virtual dom. 文章概要: virtual dom 基本概念, ...
- Vue2leaflet 替换国内地图api,带{z}/{x}/{y}形式的
参考:https://www.cnblogs.com/gispathfinder/p/9535685.html Vue2leaflet安装后,默认自带的地图URL如下 url:'http://{s}. ...
- The world is in my hands
Null项 其实我还是比较希望你能理解我的心情 无聊666回味
- 2017UGUI之slider
不让鼠标控制slider的滑动: 鼠标之所以可以控制滑动是因为slider具有interactable这个属性(下图红色的箭头的地方):如果取消了这个属性的运行的时候就不能滑动了.如果要代码去控制这个 ...
- WatchDirService 实时监控
import config.Config; import java.io.IOException; import java.nio.file.*; import java.util.List; imp ...
- 简单尝试Spring Cloud Gateway
简单尝试Spring Cloud Gateway 简介 Spring Cloud Gateway是一个API网关,它是用于代替Zuul而出现的.Spring Cloud Gateway构建于Sprin ...