git应用基础配置
2014-04-06 22:33
309 查看
1.注册github账号。注册的时候会要求输入用户名和email这是配置git必须的要素
2.在使用git的时候首先需要把注册时候配合的用户名和密码填在git仓库的配置文件里,如下
3.创建一个新的空的仓库
4.配置忽略管理的文件列表
5.添加要求同步管理的数据交给git管理
6.在github自己的账号里创建一个远程仓库,然后就能获得一个远程仓库的地址
7.把本地管理的内容同步到远程服务器
2.在使用git的时候首先需要把注册时候配合的用户名和密码填在git仓库的配置文件里,如下
harvey@harvey:~/node/.git$ git config user.name "×××××××" #配置git用户名,注册github的时候会要求输入的 harvey@harvey:~/node/.git$ git config user.email z××××××@qq.com #配置git邮箱 注册github的时候也会要求输入的
3.创建一个新的空的仓库
cd ~/node #切换到要求备份的文件夹 git init #初始化一个新的仓库
4.配置忽略管理的文件列表
harvey@harvey:~/node$ vim .gitignore #在.git所在的文件夹里创建一个和.git在同级目录下的文件.gitignore 文件 harvey@harvey:~/node$ git status #查找在Untrack状态的文件,可以根据格式添加到.gitignore文件里,就不会再在Untrack状态出现了 # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # node_modules/ # ttt.doc nothing added to commit but untracked files present (use "git add" to track) harvey@harvey:~/node$ git add .gitignore #同步忽略配置信息让所有使用本仓库的用户自动忽略相应文件 harvey@harvey:~/node$ git status #查看到效果已经生效 # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: .gitignore #
5.添加要求同步管理的数据交给git管理
##################################################### harvey@harvey:~/node$ git status #首先查看一下刚创建的git的状态 # On branch master # # Initial commit #记录更改的状态,现在是初始状态 # # Untracked files: #发现没有被跟踪的文件列表是 README httptest.js和node_modules文件夹 # (use "git add <file>..." to include in what will be committed) # # README # httptest.js # node_modules/ nothing added to commit but untracked files present (use "git add" to track) #nothing表示现在是个空的git仓库 ##################################################### harvey@harvey:~/node$ git add *.js README #生命要把js文件和ReadMe文件交给仓库管理 harvey@harvey:~/node$ git status # On branch master # Untracked files: #git add后发现没被跟踪的文件只有node_modules文件夹,说明 add的结果是httptest.js和README文件已经被跟踪了 # (use "git add <file>..." to include in what will be committed) # # node_modules/ nothing added to commit but untracked files present (use "git add" to track) ##################################################### harvey@harvey:~/node$ git commit [master (root-commit) d726721] ?芒??碌??禄麓??谩陆禄碌??媒戮? ??js??录镁潞?README???? 2 files changed, 8 insertions(+) create mode 100644 README create mode 100644 httptest.js #git commit后提示创建了mode 这就是新提交的快照文件了 ###############添加一个新的js文件测试############################## harvey@harvey:~/node$ git add *.js harvey@harvey:~/node$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: node3.js #这是新的文件和上次的快照对比的结果 # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # node_modules/ #文件结果不同但是node3.js还不在列表里表明已经被已经add了,如果被提交commit后就可以直接不会有差别的信息了 #说明可以通过state的两个列表信息就可以表示判断是在为跟踪_已跟踪_提交三种状态的哪一个了
6.在github自己的账号里创建一个远程仓库,然后就能获得一个远程仓库的地址
7.把本地管理的内容同步到远程服务器
harvey@harvey:~/node$ git remote add origin https://github.com/×××××××/nodejs.git #要往某个远程git服务器上推送内容首先要添加远程仓库 harvey@harvey:~/node$ git push -u origin master #添加主分支的内容到服务器
相关文章推荐
- JAVA基础 day22 File类的方法和应用 利用递归获取目录下的所有文件 Properties类的应用(和IO技术结合,存取配置文件) 打印流和合并流等功能类的学习应用 切割文件练习
- git配置及基础使用
- 基础应用:java web三层架构配置入门
- git rebase基础应用篇
- 第三十六课 ansible基本应用和corosync群集基础及安装配置
- Ubuntu 网络应用服务器 Apache 配置基础
- tomcat基础应用配置以及apache和nginx方向代理的配置
- Windows Server 2012活动目录基础配置与应用(新手教程)之2----创建域控制器
- 翻翻git之---简单的配置达到产品在应用市场的评价跳转功能
- 关于Git及其基础应用
- 分布式版本管理器Git的基础操作与配置指南<二>
- gradle 基础应用:统一配置信息
- git基础配置
- SpringCloud系列九:SpringCloudConfig 基础配置(SpringCloudConfig 的基本概念、配置 SpringCloudConfig 服务端、抓取配置文件信息、客户端使用 SpringCloudConfig 进行配置、单仓库目录匹配、应用仓库自动选择、仓库匹配模式)
- 翻翻git之---简单的配置达到产品在应用市场的评价跳转功能
- Git基础(一)--安装和配置SSH-Key
- Git基础 1 —— 基础配置与文件操作
- SharePoint 2016 企业项目管理应用(一,基础安装配置)
- 分布式版本管理器Git的基础操作与配置指南<一>
- 神秘Git(一)—配置及简单应用