git在本地创建工作空间并从远程版本库获取代码

1、
创建一个新的文件夹:
[root@centos http]# mkdir activityTestLee



2、
进入该文件夹
[root@centos http]# cd activityTestLee

3、
创建本地版本库:
[root@centos activityTestLee]# git init
Initialized empty Git repository in /http/activityTestLee/.git/
[root@centos activityTestLee]# git init
Initialized empty Git repository in /http/activityTestLee/.git/
4、
获取钩子:
[root@centos activityTestLee]# scp -p -P 8849 lining@IP:hooks/commit-msg .git/hooks/
Enter passphrase for key '/root/.ssh/id_rsa':
commit-msg 100% 4365 4.3KB/s 00:00

5、

从远程版本库进行克隆(相当于建立了一个链表,并没有把代码从上面copy到本地):
[root@centos activityTestLee]# git clone ssh://lining@IP:8849/activity
Initialized empty Git repository in /http/activityTestLee/activity/.git/
Enter passphrase for key '/root/.ssh/id_rsa':
remote: Counting objects: 3082, done
remote: Finding sources: 100% (3082/3082)
remote: Total 3082 (delta 1140), reused 3031 (delta 1140)
Receiving objects: 100% (3082/3082), 13.35 MiB | 670 KiB/s, done.
Resolving deltas: 100% (1140/1140), done.
6、
查看当前从远程版本库获取的东西
[root@centos activityTestLee]# ls
activity

7、
进入到文件下面:
[root@centos activityTestLee]# cd activity

8、

查看当前服务器和本地的所有分支:
[root@centos activity]# git branch -al
* master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/huodong
remotes/origin/master
remotes/origin/production
9、
创建本地分支develop并从远程版本库分支上面获取内容(现在本地有代码了)
[root@centos activity]# git checkout -b develop origin/develop
Branch develop set up to track remote branch develop from origin.
Switched to a new branch 'develop'
</pre><p><span style="color:rgb(56,56,56); font-family:gotham,helvetica,arial,sans-serif; font-size:14px; line-height:21.9999923706055px">10、</span></p><span style="color:rgb(56,56,56); font-family:gotham,helvetica,arial,sans-serif; font-size:14px; line-height:21.9999923706055px">查看有哪些文件:</span><br clear="none" style="color:rgb(56,56,56); font-family:gotham,helvetica,arial,sans-serif; font-size:14px; line-height:21.9999923706055px" /><pre name="code" class="plain">[root@centos activity]# ls
db deploy description.txt docs env_conf tools web


其实,可以从第五步开始,然后4-6-7-8-9-10

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值