安装Git$sudo apt-get install git
$sudo apt-get install git-core更新Git$git clone git://git.kernel.org/pub/scm/git/git.git安装好git后在终端输入git 命令会显示git命令提示,证明git已经安装成功。初始化代码仓库$mkdir Android4.2
$cd android4.2
$git init提示: Initialized empty Git repository in /data/Downloads/Git/android4.2/.git/证明git仓库(repository)创建成功
配置config文件(全局)$cd .git
$vim config该配置文件的原始内容为:[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true在该配置文件中加入以下内容:[receive]
denyCurrentBranch = ignore加入该配置的目的是:允许使用git push 提交代码到服务器,否则会出现以下异常:加入该配置的目的是:允许使用git push 提交代码到服务器,否则会出现以下异常:
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 git@192.168.1.X:/var/git.server/.../web
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to "git@192.168.1.X:/var/git.server/.../web"在代码仓库创建一个说明文档(该文档可以随便创建)$touch spec.txt备注:如果初始的代码仓库为空,git push origin master提交代码的时候会出现以下异常:error: src refspec master does not match any.
error: failed to push some refs to "/data/Downloads/Git/android4.2/.git
因此我们需要在初始化代码仓库之后,在仓库中创建一个文件:实例:$touch spec.txt
$git add spec.txt
$git commit-a -m "first commit"
$git push此时,基本的代码仓库已经创建完成。本地代码仓库的Git库为:/data/Downloads/Git/android4.2/.git
Linux下安装Coreseek提示“/src/sphinx.cpp:22292: undefined reference to”错误的解决办法Linux挂载移动硬盘中文乱码相关资讯 Git
- Git 2.10 发布- Push、Worktree、 (09月21日)
- 使用Eclipse上传/下载Git项目 (05月29日)
- Git 2.8.2 发布,源代码管理系统 (05月03日)
| - Git 技能学习总结 (08月05日)
- Git诞生11年后,BitKeeper宣布开源 (05月11日)
- Git 联机版注册使用 (03月30日)
|
本文评论 查看全部评论 (0)