手机版
你好,游客 登录 注册
背景:
阅读新闻

Git 使用及实战教程

[日期:2013-03-15] 来源:Linux社区  作者:longerzone [字体:大 中 小]

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$

linux
相关资讯       Git教程  Git使用  Git使用教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款