【三】Git创建仓库 您所在的位置:网站首页 创建一个git仓库要多久 【三】Git创建仓库

【三】Git创建仓库

#【三】Git创建仓库| 来源: 网络整理| 查看: 265

目录

1.git init

2.git clone

3.设置

4.git的查增删改指令

1.git init

Git 使用 git init 命令来初始化一个 Git 仓库,Git 的很多命令都需要在 Git 的仓库中运行,所以 git init 是使用 Git 的第一个命令。

在执行完成 git init 命令后,Git 仓库会生成一个 .git 目录,该目录包含了资源的所有元数据,其他的项目目录保持不变。

git init newrepo//使用指定目录newrepo作为存放地

若当前目录内有其他内容需要合并进.git仓库中,使用代码:

$ git add *.c $ git add README $ git commit -m '初始化项目版本

将 .c 结尾及 README 文件提交到仓库中

2.git clone

从已有的git仓库中copy项目:

git clone //repo为git仓库 //以下等价于以上 git clone http://github.com/CosmosHua/locate new git clone http://github.com/CosmosHua/locate.git new git clone git://github.com/CosmosHua/locate new git clone git://github.com/CosmosHua/locate.git new //还可使用不同协议 git clone [email protected]:fsliurujie/test.git --SSH协议【最快、常用】 git clone git://github.com/fsliurujie/test.git --GIT协议 git clone https://github.com/fsliurujie/test.git --HTTPS协议

copy到指定目录:

git clone //directory为本地目录 3.设置

显示当前git配置

$ git config --list credential.helper=osxkeychain core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.ignorecase=true core.precomposeunicode=true

编辑git的配置文件

$ git config -e//针对当前仓库 $ git config -e --global//针对系统上所有仓库

PS:推出编辑模式回到命令行的几种方法

1.保存并退出:

(1)按 Esc 键退出编辑模式,英文模式下输入 :wq ,然后回车(write and quit)。

(2)按 Esc 键退出编辑模式,大写英文模式下输入 ZZ ,然后回车。

2.不保存退出:   按 Esc 键退出编辑模式,英文模式下输入 :q! ,然后回车。

  按 Esc 键退出编辑模式,英文模式下输入 :qa! ,然后回车。

设置提交代码时的用户信息

$ git config --global user.name "runoob" $ git config --global user.email [email protected] 4.git的查增删改指令 //查 git config --global --list git config --global user.name git config --global user.email //增 git config --global --add user.name xxx git config --global --add user.email xxx //删 git config --global --unset user.name xxx git config --global --unset user.email xxx //改 git config --global user.name xxx git config --global user.email xxx


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有