GitHub 上传及下载代码
来源:互联网 发布:16奥运会中国男篮数据 编辑:程序博客网 时间:2024/06/05 10:46
GitHub 上传及下载代码
github是开源的代码管理工具,同时也是一个很好的开源学习平台,学习如何使用github也是非常重要的,以下是我梳理的一些常用的命令
配置
首先初次运行配置全局的用户名和密码,不然以后每次添加都需输入用户名和密码这样比较繁琐,在打开的git shell中输入这个,替换里面的[username]和[email]
git config –global user.name [username]
git config –global user.email [email]
可以通过git config –list命令查看当前gitshell的一些设置
$ git config --listcore.symlinks=falsecore.autocrlf=truecore.fscache=truecolor.diff=autocolor.status=autocolor.branch=autocolor.interactive=truehelp.format=htmlhttp.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt..........
初始化
配置完成之后,进入你的目录,先运行一个初始化命令
git init
添加
接下来就是你要添加的文件,用git add命令
git add . (表示添加所有改变)
- git add . :他会监控工作区的状态树,使用它会把工作时的所有变化提交到暂存区,包括文件内容修改(modified)以及新文件(new),但不包括被删除的文件。
- git add -u :他仅监控已经被add的文件(即tracked file),他会将被修改的文件提交到暂存区,add -u 不会提交新文件(untracked file)。(git add –update的缩写)
- git add -A :是上面两个功能的合集(git add –all的缩写)
- git add后面接文件或者文件夹则会将这个文件或者文件夹提交
提交注释
git commit -m 提交注释文件,说明本次修改的内容和其他说明
git commit -m “需要说明的内容”
再提交之前需要用git status 命令擦好看里面提交内容的变化,确认后再提交
关联respositories
接下来也是比较重要的一步关联github的项目可以进入需要添加的项目复制里面的URL
在gitshell中运行以下命令,这样其实origin就代表这个地址 https://github.com/*/MapReduce 当然你也可以用其他的名字如origin2等等,或者添加多个respositories,在push的时候添加对应的变量名称就行了;
git remote add origin https://github.com/*/MapReduce
向respositories push更新
最后一步就是push命令了
输入以下命令提交修改,其中后面的master表示版本号,origin是前面取得remote地址的名字提交之后后显示,表示push成功。
git pull origin master
$ git push -u originCounting objects: 3, done.Delta compression using up to 8 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 402 bytes | 0 bytes/s, done.Total 3 (delta 1), reused 0 (delta 0)remote: Resolving deltas: 100% (1/1), completed with 1 local object.To https://github.com/HubSKY/MapReduce 5886228..82bf299 master -> masterBranch master set up to track remote branch master from origin2.
pull拉取修改,更新本地
下载同步代码就是pull命令
git pull origin master
$ git pull origin masterFrom github.com:HubSKY/MapReduce * branch master -> FETCH_HEAD 5886228..82bf299 master -> origin/masterAlready up-to-date.
用gitshell管理很方便,git shell还包含分支创建,合并和删除等,这里就不一一细讲,以上这些命令就足够平常我们这些人使用了
- GitHub 上传及下载代码
- github 上传和下载代码
- github的常用命令/上传和下载代码
- git简介及上传代码到github
- github 的创建及代码上传
- 【eclipse下使用git上传(下载)代码至(从)github】
- 【eclipse下使用git上传(下载)代码至(从)github】
- 【eclipse下使用git上传(下载)代码至(从)github】
- eclipse上使用git上传或下载代码至github
- 【eclipse下使用git上传(下载)代码至(从)github】
- github上传与下载
- 如何将本地代码上传github 以及在github下载代码到本地
- 上传项目到github上及删除代码
- Github上传代码 及后期怎么使用 详细教程
- github上传代码
- github上传代码
- Github上传代码
- Github 上传代码
- 转载csdn文章
- C语言-构造数据类型
- 浅谈栈帧
- 存储过程
- Android Studio 三种添加插件的方式
- GitHub 上传及下载代码
- maven 项目拆分配置文件为单独的项目(即maven项目如何依赖另一个项目的配置文件)
- shiro登录过程
- request数据读取
- 多态及其对象模型
- leetcode No56. Merge Intervals
- Mysql数据优化(17.07)
- TensorFlow学习笔记(五)Session的2种用法
- 译文: Spring Security 与 Active Directory LDAP 例子