3.2 用户端 Git 配置
1) 在客户端克隆git 仓库
long@long-Ubuntu:~$ git clone zyl@project:/home/zyl/study.git/.git
Cloning into 'study'...
The authenticity of host 'project (202.201.0.141)' can't be established.
ECDSA key fingerprint is 23:76:83:76:36:23:6a:c4:70:82:eb:f8:8b:46:ba:ea.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'project,202.201.0.141' (ECDSA) to the list of known hosts.
Password:
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
long@long-Ubuntu:~$ cd study/
long@long-Ubuntu:~/study$ ls
first
long@long-Ubuntu:~/study$
2) 做一些客户端的修改,比如 用户端的名称,邮箱,以及默认的编辑器
long@long-Ubuntu:~/study$ git config --global user.email "reaper888@yeah.net"
long@long-Ubuntu:~/study$ git config --global user.name "long"
long@long-Ubuntu:~/study$ git config --global core.editor vim
long@long-Ubuntu:~/study$
3) 我们创建一个文件,测试客户端能不能正常使用
long@long-Ubuntu:~/study$ vim first_clinet
long@long-Ubuntu:~/study$ ls
first first_clinet
long@long-Ubuntu:~/study$ git add first_clinet
long@long-Ubuntu:~/study$ git commit -m " first test of client"
[master 53affb3] first test of client
1 file changed, 1 insertion(+)
create mode 100644 first_clinet
long@long-Ubuntu:~/study$ git push
Password:
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 296 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To zyl@project:/home/zyl/study.git/.git
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'zyl@project:/home/zyl/study.git/.git'
long@long-Ubuntu:~/study$
