git 远程库的建立方法

  • 聚客宝
  • 2021-08-20 10:30:22

1、登录远程Git服务器

> ssh git@58.57.109.22

提示输入密码,登录远程git服务器


2、建立裸仓库

> git init --bare 远程git项目名称


3、本地仓库挂接远程仓库

> git remote add origin git@58.57.109.22:/www/wroot/git/仓库名称.git


4、备份本地数据


(1)第一次推送,需要加 -u参数

> git push -u origin master

(2)第二次

>git push origin master


5、更换远程仓库


git remote rm origin


6、查看远程仓库


git remote

git remote site.git