【Git & GitHub】利用Git Bash进行第一次提交文件
来源:互联网 发布:mysql如何添加触发器 编辑:程序博客网 时间:2024/06/10 13:31
利用Git Bash进行第一次提交文件
快下班的时候,MD群里有人问怎么向github上提交文件,下面进行简单的介绍:
(1) GitHub中创建一个工程
仓库的https地址:https://github.com/bluetata/blog.csdn.dietime1943.git
GitHub上创建仓库后生成的提示
Create a new repository on the command line :
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/bluetata/blog.csdn.dietime1943.git
git push -u origin master
Push an existing repository from the command line :
git remote add origin https://github.com/bluetata/blog.csdn.dietime1943.git
git push -u origin master
(2) 初始化git目录
$ cd D:/001_workspaces/098_Github
$ git init
如果不执行这条命令, 就会出现错误 :fatal: Not a git repository (or any of the parent directories): .git 。
(3) 追加文件到缓存
$ git add -A// 表示将所有的已跟踪的文件的修改与删除和新增的未跟踪的文件都添加到暂存区
(4) 进行commit提交
$ git commit -m "commit test"
如果第一次进行提交会出现如下提示信息:
bluetata@IBM012-PC06874UMINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)
$ git commit -m "commit test"
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'bluetata@IBM012-PC06874U.(none)')
根据提示按照如下输入即可(输入完后会弹出github登录的pop提示框):
bluetata@IBM012-PC06874UMINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)
$ git config --global user.email "dietime1943@hotmail.com"
bluetata@IBM012-PC06874UMINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)
$ git config --global user.name "bluetata"
(5) Push到远程仓库(提交到github服务器中)
$ git push -u origin master
最后:附上完整的操作记录:
bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ lltotal 13-rw-r--r-- 1 bluetata 197121 2263 Feb 17 11:03 'add user library to project in eclipse.md'drwxr-xr-x 1 bluetata 197121 0 May 11 16:18 article/drwxr-xr-x 1 bluetata 197121 0 Mar 29 22:10 interviews/drwxr-xr-x 1 bluetata 197121 0 Mar 29 22:10 jsoup/drwxr-xr-x 1 bluetata 197121 0 Mar 29 22:10 maven/-rw-r--r-- 1 bluetata 197121 73 Mar 28 19:02 README.md-rw-r--r-- 1 bluetata 197121 2154 Feb 8 10:06 'solution of tomcat 404.md'bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git add -Abluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git commit -m "commit test"*** Please tell me who you are.Run git config --global user.email "you@example.com" git config --global user.name "Your Name"to set your account's default identity.Omit --global to set the identity only in this repository.fatal: unable to auto-detect email address (got 'bluetata@IBM012-PC06874U.(none)')bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git config --global user.email "dietime1943@hotmail.com"bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git config --global user.name "bluetata"bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git add -Abluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git commit -m "commit test"[master f6d6241] commit test 6 files changed, 6 insertions(+), 96 deletions(-) create mode 100644 .tags1 delete mode 100644 Jsoup01.html delete mode 100644 Jsoup01.md delete mode 100644 Jsoup02.md create mode 100644 article/CSDN link problems.md rename "maven/ \343\200\220\350\207\252\345\255\246maven\347\263\273\345\210\227\343\200\221\345\210\233\345\273\272simple project.md" => "maven/\343\200\220\350\207\252\345\255\246maven\347\263\273\345\210\227\343\200\221\345\210\233\345\273\272simple project.md" (100%)bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)$ git push -u origin masterCounting objects: 6, done.Delta compression using up to 4 threads.Compressing objects: 100% (5/5), done.Writing objects: 100% (6/6), 678 bytes | 0 bytes/s, done.Total 6 (delta 3), reused 0 (delta 0)remote: Resolving deltas: 100% (3/3), completed with 3 local objects.To https://github.com/bluetata/blog.csdn.dietime1943.git 99590f3..f6d6241 master -> masterBranch master set up to track remote branch master from origin.
注:本文原创由`bluetata`发布于blog.csdn.net、转载请务必注明出处。
- 【Git & GitHub】利用Git Bash进行第一次提交文件
- git bash第一次 提交code提示错误
- 第一次使用git提交本地文件到github
- 利用Git-Bash上传代码至github
- 使用Git Bash上传文件到github
- Git Bash for GitHub
- Shell/Bash/git/github
- 通过git bash向github远程仓库提交代码
- AndroidStudio第一次提交项目代码到git服务器/github
- 第一次使用Git将AS项目提交至GitHub
- AndroidStudio第一次提交项目代码到git服务器/github
- 利用git bash把本地项目上传的github
- git 提交 github 学习
- git提交到github
- Git提交GitHub问题
- git提交到github
- git提交到github
- git提交到github
- 数据库连接池原理详解与自定义连接池实现
- php基础篇--wy
- Apache配置中文说明
- Windows 底下根据一个进程的名字杀死一个进程的代码
- apache与https(远程数据传输加密)
- 【Git & GitHub】利用Git Bash进行第一次提交文件
- String、StringBuffer、与StringBuilder的区别
- Linux SVN 命令详解
- 语音合成vocoder(四) aperiodicity参数
- npm版本升级问题
- How I’ve handled multiple screen resolutions in my Unity3D game
- 对象序列化
- Android 5.0 M特性 样式设置
- C++文件读写详解