Git CMD - init: Create an empty Git repository or reinitialize an existing one

命令格式

git init [-q | --quiet] [--bare] [--template=<template_directory>]
    [--separate-git-dir <git dir>]
    [--shared[=<permissions>]] [directory]

命令参数

--quiet, -q

  安静模式,只打印错误和警告信息。

实例

a) 创建版本库

[[email protected] git]$ mkdir hello_git
[[email protected] git]$ cd hello_git/
[[email protected] hello_git]$ git init
Initialized empty Git repository in /home/ucm/git/hello_git/.git/

b) 为已存在的代码库创建版本库

[[email protected] git]$ mkdir hello_world
[[email protected] git]$ echo -e ‘#!/usr/bin/python\nprint "hello world"‘ > hello_world/hello.py
[[email protected] git]$ chmod a+x hello_world/hello.py
[[email protected] git]$ cd hello_world/
[[email protected] hello_world]$ git init
Initialized empty Git repository in /home/huye/git/hello_world/.git/
[[email protected] hello_world]$ git add .
[[email protected] hello_world]$ git commit -m "Start a new Git repository for an existing code base"
[master (root-commit) b65bd46] Start a new Git repository for an existing code base
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100755 hello.py

更多

http://git-scm.com/docs/git-init

时间: 2024-08-08 22:05:38

Git CMD - init: Create an empty Git repository or reinitialize an existing one的相关文章

Git CMD - add: Record changes to the repository

命令格式 git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend] [--dry-run] [(-c | -C | --fixup | --squash) <commit>] [-F <file> | -m <msg>] [--reset-author] [--allow-empty] [--allow-empty-message] [--no-verify] [-e]

Git CMD - config: Get and set repository or global options

命令参数 --get 获取指定的配置项. --global 对于写选项:全局配置,将参数配置于 ~/.gitconfig 而不是仓库目录下的 .git/config.对于读选项:只从 ~/.gitconfig 文件中读取配置. --local 对于写选项:将参数配置于 仓库目录下的 .git/config,这是默认的设置. -l, --list 列出配置文件中的所有配置项. 配置文件 如果没有显示地指定 --file 选项,则有 4 个文件供 git 配置查询配置项. $(prefix)/etc

git错误:fatal: Not a git repository (or any of the parent directories): .git

git错误:fatal: Not a git repository (or any of the parent directories): .git 我用git add file添加文件时出现这样错误: fatal: Not a git repository (or any of the parent directories): .git 提示说没有.git这样一个目录,解决办法如下: git init就可以了!

git - Trying to create a local repo of go.tools that is go get-able - Stack Overflow

git - Trying to create a local repo of go.tools that is go get-able - Stack Overflow

使用Git Gui从Bonobo服务器中克隆Repository(仓库)

刚开始在使用Git Gui从Bonobo服务器中克隆Repository(仓库)中遇到一些问题,如下图所示: 后来百度,有人遇到类似的问题,得到解决思路,请大家参考这里.大意说出现这个问题是因为要克隆的远程Repository(库)是个空库.那我们就找一个“有内涵的”远程库克隆吧,克隆步骤如下: 打开“Git Gui”,如下图所示: 点击“Clone Existing Repository”,在“Source Location”文本框中输入远程库的位置,在“Target Directory”文本

git提交代码出现错误fatal: Unable to create &#39;项目路径/.git/index.lock&#39;: File exists.

git提交代码出现错误fatal: Unable to create '项目路径/.git/index.lock': File exists. 具体出错代码如下: 具体原因不详,在stackoverflow上查找了很久,也不清楚原因,但是stackoverflow给出了解决的方法. 解决方法: 在当前项目下打开git bash,运行如下命令: rm -f ./.Git/index.lock 只为成功找方法.大胆的尝试,下一个fun就是你的fun! git提交代码出现错误fatal: Unable

Git CMD - reset: Reset current HEAD to the specified state

命令格式 git reset [-q] [<tree-ish>] [--] <paths>…? git reset (--patch | -p) [<tree-ish>] [--] [<paths>…?] git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] 命令格式 -- soft 回退版本,但不会回退工作区与暂存区的修改. -- mixed

Git版本控制工具(一)----git的安装及创建版本库

?[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/3981720.html 联系方式:[email protected] [正文] 一.初识Git: Git是目前世界上最先进的分布式版本控制系统(没有之一).它的开发者就是大名鼎鼎的Linux操作系统的作者Linus Torvalds.Git被开发出来的初衷是为了更好的管理Linux内核,而现在却广

Git详解之二:Git基础

原文:<Pro Git> Git 基础 读完本章你就能上手使用 Git 了(伯乐在线注:如果你对Git还不了解,建议从本Git系列第一篇文章开始阅读).本章将介绍几个最基本的,也是最常用的 Git 命令,以后绝大多数时间里用到的也就是这几个命令.读完本章,你就能初始化一个新的代码仓库,做一些适当配置:开始或停止跟踪某些文件:暂存或提交某些更 新.我们还会展示如何让 Git 忽略某些文件,或是名称符合特定模式的文件:如何既快且容易地撤消犯下的小错误:如何浏览项目的更新历史,查看某两次更新之间的差