Git使用Git

git推送代码到不同服务器

2017-02-20  本文已影响55人  EldonZhao

一、需求背景:

公司版本管理服务器上有代码仓库A,个人在github上有账号。现在需要把代码仓库A推送到个人github上的repository里。

二、解决方法:

使用git push可以实现该需求。

  1. clone仓库A代码:
git clone https://jdjr.com/EldonZhao/repoA.git
  1. github上创建repository:
    在github网站上添加一个repository,如myRepo。

  2. 添加远程仓库:

cd repoA
git remote add myRepo https:github.com/EldonZhao/myRepo.git
  1. 推送代码到github仓库:
git push --all myRepo

三、查看github仓库中代码:

打开gihub上myRepo仓库,可以看到代码已经上传成功。

上一篇 下一篇

猜你喜欢

热点阅读