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

来源:互联网 发布:昆明火车站暴恐案 知乎 编辑:程序博客网 时间:2024/05/02 23:00
在本地建立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
原创粉丝点击