参考文章链接:
https://www.jianshu.com/p/38b345846dfc
https://www.jianshu.com/p/1d3b06b2b8ce
http://www.360doc.com/content/16/0509/10/12278201_557483906.shtml
安装 brew和git;
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
http://t.zoukankan.com/liyuzhao-p-4394474.html
git 常用指令:
https://www.cnblogs.com/jeesezhang/p/4350313.html
permission denied解决方法:
https://blog.csdn.net/u011978079/article/details/89784971
建立本地仓库的主要指令:
sudo git --bare init
cd ..
sudo chmod -R 777 gitService
cd gitService
sudo vim config
插入:
[receive]denyCurrentBranch = ignore, 记得属性换行!不能有多余的空格,否则报错。
Shift + G, 再输入o, w保存,q退出,冒号:是指令开头, :q! 是不保存退出,:wq是保存后退出编辑。
新建文件夹,测试
cd /Users/yellow/Downloads/gitClient
sudo git clone yellow@192.168.0.249:/Users/yellow/Documents/gitService
测试可以再客户端输入:
git status
实战记录:
yellow@yellowdeMacBook-Pro ~ % cd /Users/yellow/Documents/gitService
yellow@yellowdeMacBook-Pro gitService % sudo git --bare init
Password:
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m
Initialized empty Git repository in /Users/yellow/Documents/gitService/
yellow@yellowdeMacBook-Pro gitService % cd ..
yellow@yellowdeMacBook-Pro Documents % sudo chmod -R 777 gitService
yellow@yellowdeMacBook-Pro Documents % cd gitService
yellow@yellowdeMacBook-Pro gitService % sudo vim config
yellow@yellowdeMacBook-Pro gitService % sudo vim config
yellow@yellowdeMacBook-Pro gitService % cd /Users/yellow/Downloads/gitClient
yellow@yellowdeMacBook-Pro gitClient % sudo git clone yellow@192.168.0.249:/Users/yellow/Documents/gitService
Cloning into 'gitService'...
The authenticity of host '192.168.0.249 (192.168.0.249)' can't be established.
ED25519 key fingerprint is SHA256:LGsMk9lSnyB4hrTyDDdy8CO8dfttrhb38Hm7aT+znys.
This host key is known by the following other names/addresses:
/var/root/.ssh/known_hosts:1: 172.20.10.5
/var/root/.ssh/known_hosts:4: 169.254.60.168
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.0.249' (ED25519) to the list of known hosts.
(yellow@192.168.0.249) Password:
warning: You appear to have cloned an empty repository.
yellow@yellowdeMacBook-Pro gitClient % cd /Users/yellow/Documents/gitService
yellow@yellowdeMacBook-Pro gitService % git pull
fatal: this operation must be run in a work tree
yellow@yellowdeMacBook-Pro gitService % git status
fatal: this operation must be run in a work tree
网友评论