当前位置: 首页 > Web前端 > HTML

Day88-100如何将Git仓库代码推送到另一个新的Git仓库

时间:2023-03-28 14:13:33 HTML

(1)需求需要将旧代码库中的指定分支推送到新的Git仓库。(2)步骤1.新建Git仓库2.将本地代码仓库切换到新的Git仓库地址#替换remotegitremoteset-urloriginhttp://***.gitgitremoteset-urlorigin--pushhttp://***.git3,将新的SSH证书添加到远程新建Git仓库所在的SSH认证码库中ssh-keygen-trsa-C"email"catid_dev_rsa.pub#将生成的公钥复制到Git仓库在该账户的SSH账户中添加#,可能会遇到没有权限的问题,需要设置全局密码cd~/.ssh/gitconfig--listgitconfig--globaluser.name"name"gitconfig--globaluser.password"password"gitconfig--globaluser.email"email"4.推送当前分支代码//推送代码gitpush5.切换本地分支,继续推送分支代码//推送代码gitcheckout(3)附:其他常用的Git命令#branchrenamegitbranch-mold_namenew_name#rename并推送到远程gitpushoriginnew_name#deleteremoteoldbranchgitpushorigin--deleteold_name#gitmergeremotebranchgitpulloriginbranch_name#gitmergelocalbranchgitmergebranch_name#gitgiveup/terminatemerginggitmerge--abort最后,我启动了一个front-分享阅读会结束,有兴趣的小伙伴可以一起阅读(ardenzhaogx)