hncys 发表于 2018-9-17 13:38:18

git的日常应用

切换到代码目录:  
huwei@huwei:/web/www.kutongji.com/www.gits/www_old$ cd ..
  
huwei@huwei:/web/www.kutongji.com/www.gits$ cd www_old/
  
查看目录关联的远程机,很明显因为从git服务器上clone,因此目录里面有一个主机是origin表示git主机
  
huwei@huwei:/web/www.kutongji.com/www.gits/www_old$ git remote -v
  
origingit@gitxm.com:kutongji/www_old.git (fetch)
  
origingit@gitxm.com:kutongji/www_old.git (push)
  
添加线上服务器主机,其中root@192.168.66.35:/web/www.kutongji.com/www.gits为裸库git地址,kutongji为一个主机别名,并非真实主机名称
  
huwei@huwei:/web/www.kutongji.com/www.gits$ git remote add kutongji root@192.168.66.35:/web/www.kutongji.com/www.gits
  
huwei@huwei:/web/www.kutongji.com/www.gits/www_old$ git remote -v
  
kutongjiroot@192.168.66.35:/web/www.kutongji.com/www.gits (fetch)
  
kutongjiroot@192.168.66.35:/web/www.kutongji.com/www.gits (push)
  
origingit@gitxm.com:kutongji/www_old.git (fetch)
  
origingit@gitxm.com:kutongji/www_old.git (push)
  
查看本地目录的分支
  

  
huwei@huwei:/web/www.kutongji.com/www.gits/www_old$ git branch
  
* develop
  
推送本地分支到线上服务器裸库
  
huwei@huwei:/web/www.kutongji.com/www.gits/www_old$ git push kutongji develop
  
Counting objects: 31357, done.
  
Delta compression using up to 2 threads.
  
Compressing objects: 100% (8517/8517), done.
  
Writing objects: 100% (31357/31357), 63.93 MiB | 10.19 MiB/s, done.
  
Total 31357 (delta 20722), reused 31357 (delta 20722)
  
To root@192.168.66.35:/web/www.kutongji.com/www.gits
  
*       develop -> develop


页: [1]
查看完整版本: git的日常应用