[Linux]本地模拟配置服务器端git仓库

在本地建立base ,gitA  , gitB;
用base作为服务器端,gitA、gitB作为本地端从服务器中clone和push代码,本地验证是OK的
以下是我总结的内容:


1、创建 base gitA gitB 三个目录


2、$ cd base

     $ git config --global user.name "Your Name"   //Your Name (是你的计算机名称)
     $ git config --global user.email "youe@example.com  //youe@example.com(计算机名称@localhost) 因为本地所以@+localhost才能在git clone时可以成功

3、$ git init

        当git init完成时 使用命令"la"就可以看到目录下存在一个.git文件夹
        『重要』打开.git/config 添加一下内容
[receive]
        denyCurrentBranch = false

下面几步还要注意一下

4、在base目录下

touch A.txt
git status .
git add .
git commit -m "new file"


5、现在gitA目录下

$ git clone archer@localhost:~/AAAAAA/L100    //"~/AAAAAA/L100"是我的服务器段
$ git clone archer@localhost:~/LIU_workspace/base
Cloning into 'base'...
archer@localhost's password:[我的密码]

如果要区分gitA 和base里的提交人需要在
gitA/base$ git config user.name = "A"
gitA/base$ git config user.email = "A@A.com"

这样你在gitA/base$提交代码Author就是:A<A@A.com>啦


现在可以正常的git 操作了!!!

我这里配置是OK的,你们配置的是不是呢?

谢谢!


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值