`
hongtoushizi
  • 浏览: 359073 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

git项目的remote地址替换

    博客分类:
  • git
阅读更多

This week I'll show you how you can move a full Git repository from one remote server to another. The steps I'm using even allow you to choose which branches and tags to include.

Let’s call the original repository ORI and the new one NEW, here are the steps I took to copy everything from ORI to NEW:

  1. Create a local repository in the temp-dir directory using:
     
     
     
     
     
    1
    git clone <url to ORI repo> temp-dir
     
     
    Git clone original repository into local temp-dir
  2. Go into the temp-dir directory.
  3. To see a list of the different branches in ORI do:
     
     
     
     
     
    1
    git branch -a
     
     
    See all the Branches
  4. Checkout all the branches that you want to copy from ORI to NEW using:
     
     
     
     
     
    1
    git checkout branch-name
     
     
    Checkout all branches
  5. Now fetch all the tags from ORI using:
     
     
     
     
     
    1
    git fetch --tags
     
     
    Fetch all the tags
  6. Before doing the next step make sure to check your local tags and branches using the following commands:
     
     
     
     
     
    1
    git tag
    2
    git branch -a
     
     
    Git tag and Git branch to check if we have everything we need.
  7. Now clear the link to the ORI repository with the following command:
     
     
     
     
     
    1
    git remote rm origin
     
     
  8. Now link your local repository to your newly created NEW repository using the following command:
     
     
     
     
     
    1
    git remote add origin <url to NEW repo>
     
     
  9. Now push all your branches and tags with these commands:
     
     
     
     
     
    1
    git push origin --all
    2
    git push --tags
     
     
    The End Result of our 10 steps.
  10. You now have a full copy from your ORI repo.
分享到:
评论

相关推荐

    Git-2.23.0/win64/32/mac 多文件

    忽略超级项目gitlink中记录的提交对象名称 而是使用恰好位于最前端的提交 通过传递新的远程跟踪分支从一开始 “--remote-submodules”选项。 *模式“git diff / grep”用于提取功能和单词 Matlab的边界已扩展...

    详解Ubuntu环境下部署Django+uwsgi+nginx总结

    前言 这是我在搭建Django项目时候的过程,拿来总结记录,以备不时之需。 项目采用nginx+uwsgi的搭配方式。...$ git remote add origin xxx.git # 替换成你的项目git地址 $ git add . $ git commit -m

    gitsync-plugins:预装的gitsync插件包

    gitsync中的内置插件gitsync插件increment -提供增量配置转储到源sync-remote remote-使用远程git存储库添加同步功能( git pull和git push命令) limit -增加了限制存储库的最小,最大版本号以及每次运行的卸载版本...

    authentication

    git clone git remote add origin :TreyK95 / starter.git &lt;新项目名称&gt;(每次克隆时更改) cd进入您命名的项目 运行捆绑 在database.yml中将database.yml重命名为唯一的名称(使用项目名称) 搜索starter并...

    安卓java读取网页源码-doc:百宝箱

    替换brew.git、homebrew-core.git地址为阿里巴巴下镜像下的仓库 cd "$(brew --repo)" git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew...

    Homebrew 国内安装脚本快速部署 brew 国内镜像

    mysql安装配置教程。Homebrew 国内安装脚本,快速部署 brew ,国内镜像。Homebrew是一款在macOS系统上...```shell$HOMEBREW_CORE_GIT_REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.gi$HOMEBREW_BOT

    refactorTractor:小组重构项目

    由于您不想将您的项目命名为“ webpack-starter-kit”,因此在运行git clone (可以将[...]替换为终端命令参数)时,可以使用可选参数: git clone [remote-address] [what you want to name the repo] 删除默认的...

    overlook:Mod 2最终项目

    由于您不想将您的项目命名为“ webpack-starter-kit”,因此在运行git clone时可以使用一个可选参数(用终端命令参数替换[...] ): git clone [remote-address] [what you want to name the repo] 删除默认的远程...

    hw-myspace-demo:演示硬件小组项目第6周DPL SP21

    入门TLDR:需要使用唯一的项目名称进行克隆并重命名数据库git clone :jimibue ...首选) git remote rm origin 创建一个新的github仓库git remote add origin sshlinktorepo 完全删除git repo并重新创建一个新的repo r

    webpack-starter-kit:利用webpack的项目入门套件

    由于您不想将您的项目命名为“ webpack-starter-kit”,因此在运行git clone时可以使用一个可选参数(用终端命令参数替换[...] ): git clone [remote-address] [what you want to name the repo] 删除默认的远程...

    start-here-guides:让Git从开源世界开始

    在进行任何更改之前, 以避免合并冲突: git remote add upstream https://github.com/zero-to-mastery/start-here-guidelines.gitgit pull upstream master 如果遇到合并冲突,则必须解决冲突。 在线上有很多指南...

    Makecraper

    $ git remote rm origin $ git remote add origin git@github.com:YOUR_GITHUB_USERNAME/makescraper.git $ go mod download 在编辑器中打开README.md ,并将您的所有实例YOUR_GITHUB_USERNAME替换为您的GitHub...

    makescraper:使用Go进行网页搜刮!

    :spider: 制作爬虫 使用Go和... 在终端中逐行运行每个命令行以设置项目: $ git clone git@github.com:Make-School-Labs/makescraper.git$ cd makescraper$ git remote rm origin$ git remote add origin git@github....

    从此处开始指南:让Git从“零掌握”的开源游乐场开始,进入开源世界。 专为教育和实践经验目的而设计

    有关此开源社区如何工作的准则:) 阅读下面的内容,了解如何加入现有项目或创建自己的项目。 该社区的一条规则: 我们不在乎您是否会碰坏东西。 这是一个游乐场,我们鼓励经常失败。...git remote add upstre

    starter-spring-21

    入门 TLDR:需要使用唯一的项目名称进行克隆并重命名数据库 git clone :jimibue / starter-spring-21.git &lt;...git remote add origin sshlinktorepo 完全删除git repo并重新创建一个新的repo rm -

    DoctorApp

    入门TLDR:需要使用唯一的项目名称进行克隆并重命名数据库git clone :jimibue...首选) git remote rm origin创建一个新的github仓库git remote add origin sshlinktorepo完全删除git repo并重新创建一个新的repo rm -

    Appointment:约会应用程序有很多

    入门 TLDR:需要使用唯一的项目名称进行克隆并重命名数据库 git clone :jimibue / starter-spring-21.git &lt;...git remote add origin sshlinktorepo 完全删除git repo并重新创建一个新的repo rm -

    overlook

    由于您不想将您的项目命名为“ webpack-starter-kit”,因此在运行git clone时可以使用一个可选参数(用终端命令参数替换[...] ): git clone [remote-address] [what you want to name the repo] 删除默认的远程...

    hotel-dashboard-app

    由于您不想将您的项目命名为“ webpack-starter-kit”,因此在运行git clone时可以使用一个可选参数(用终端命令参数替换[...] ): git clone [remote-address] [what you want to name the repo] 删除默认的远程...

Global site tag (gtag.js) - Google Analytics