比如说,将 https://github.com/lizhenliang/tomcat-java-demo 迁移到 https://github.com/lousia001/tomcat-java-demo
步骤如下:
#从https://github.com/lizhenliang/tomcat-java-demo拉取代码
[root@ ~]# git clone https://github.com/lizhenliang/tomcat-java-demo
Cloning into 'tomcat-java-demo'...
remote: Enumerating objects: , done.
remote: Counting objects: % (/), done.
remote: Compressing objects: % (/), done.
remote: Total (delta ), reused (delta ), pack-reused
Receiving objects: % (/), 4.52 MiB | 46.00 KiB/s, done.
Resolving deltas: % (/), done.
[root@ ~]# ls
anaconda-ks.cfg tomcat-java-demo tomcat-java-demo.bak
[root@ ~]# cd tomcat-java-demo
[root@ tomcat-java-demo]# ls
doc Dockerfile LICENSE pom.xml README.md src
# 修改隐藏的 .git/config文件,替换掉一样
[root@ tomcat-java-demo]# vi .git/config
[root@ tomcat-java-demo]# git remote add origin https://github.com/lousia001/tomcat-java-demo.git
[root@ tomcat-java-demo]# git push -u origin master
Username for 'https://github.com': lousia001
Password for 'https://lousia001@github.com':
Counting objects: , done.
Compressing objects: % (/), done.
Writing objects: % (/), 4.52 MiB | 1.32 MiB/s, done.
Total (delta ), reused (delta )
remote: Resolving deltas: % (/), done.
To https://github.com/lousia001/tomcat-java-demo
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
到此, 代码迁移成功。
作者: 梅梅~
出处: https://www.cnblogs.com/keeptesting
关于作者:专注软件测试,测试运维相关工作,请多多赐教!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 原文链接 欢迎沟通交流加微信联系。 微信:yangguangkg20140901 暗号:博客园.