天天看点

git链接github

git 

Directory:使用Git管理的一个目录,也就是一个仓库,包含我们的工作空间和Git的管理空间。

WorkSpace:需要通过Git进行版本控制的目录和文件,这些目录和文件组成了工作空间。

.git:存放Git管理信息的目录,初始化仓库的时候自动创建。

Index/Stage:暂存区,或者叫待提交更新区,在提交进入repo之前,我们可以把所有的更新放在暂存区。

Local Repo:本地仓库,一个存放在本地的版本库;HEAD会只是当前的开发分支(branch)。

Stash:是一个工作状态保存栈,用于保存/恢复WorkSpace中的临时状态。

git init             创建仓库(初始化)

git add test.txt     将文件提至暂存区

git status           查看版本状态

git commit -m        将暂存区提交更新  -m 是后面的描述

git log              查看日志

配置身份

git config --global user.name "coder-pig"     

git congif --global user.email "[email protected]"

create a new repository on the command line

echo "# test" >> README.md

git init

git add README.md

git commit -m "first commit"

git remote add origin https://github.com/webws/test.git //远程连接仓库

origin是别名的设置,第一次链接后 .git/config 里面的就记录了origin 就是github的地址

git push -u origin master

push an existing repository from the command line

git remote add origin https://github.com/webws/test.git

git push -u origin master

提示出错信息:fatal: remote origin already exists.

    解决办法如下:

    1、先输入$ git remote rm origin

    2、再输入$ git remote add 

继续阅读