美文网首页
git以及github使用教程

git以及github使用教程

作者: 张柴柴 | 来源:发表于2018-05-26 18:53 被阅读0次

创建秘钥

 

ssh-keygen -t rsa -b 4096 -c "邮箱地址"
clipboard.png

github添加远程公钥

 

clipboard1.png

克隆远程仓库

 

clipboard2.png clipboard3.png clipboard4.png

clone 项目

用于把GitHub上的项目克隆到本地变为本地仓库

git clone git@github项目地址

添加项目并提交

 

# 创建新文件
touch 1.html

# 将当前目录的所有文件提及到缓存区
git add .
git commit -am "xxxx"

# 推送到远程仓库
git push xxx master

本地创建一个git项目并提交到GitHub的空仓库

 

github上先添加一个空仓库

 

clipboard5.png
QQ截图20180526182552.png

本地创建一个git项目

 

# 创建目录
mkdir resume
cd resume

# 初始化仓库
git init

# 创建一些文件或者目录
mkdir blog
touch blog/10分钟学习入手Git.md
touch blog/使用Markdown写文章.md

mdkir projects
touch projects/demo1.html

touch README.md

# 配置远程仓库地址并设置标签,这里设置了一个resume标签
git remote add resume git@github.com:zhangcl0531/resume.git

# 查看当前本地库记录的远程仓库
$ git remote -v
resume  git@github.com:zhangcl0531/resume.git (fetch)
resume  git@github.com:zhangcl0531/resume.git (push)

# 提交
git add .
git commit -am "xxxx"
git push resume  master
QQ截图20180526184352.png

删除修改标签

 

# 删除本地仓库的远程仓库
git remote remove 标签名

# 修改远程仓库标签名
git remote rename 原标签名 新标签名

# 修改远程仓库地址
git remote set-url 标签名  新的远程仓库地址

分支操作

 

# 创建本地库dev 分支
git branch dev

# 切换到dev分支
git checkout dev

# 推送更新到dev分支
git push 标签名 dev

# 查看所有分支,带* 表示当前所在位置
git branch -a

# 合并分支,先切换到master,再合并
git checkout master
# 将dev分支合并当当前master分支上
git merge dev 


相关文章

  • Github

    Github使用教程一Github使用教程二Github使用教程三 Git常用命令Git之使用GitHub搭建远程仓库

  • git以及github使用教程

    创建秘钥 github添加远程公钥 克隆远程仓库 clone 项目 用于把GitHub上的项目克隆到本地变为本地仓...

  • Git和Github的基础使用

    Git和Github新手极简使用教程 Git和Github介绍:百度/Google-搜索关键词: SVN Git ...

  • 码农周刊分类整理 -- G

    GIT [译] 通过示例学习 Git 内部构造(@夏永锋_SJTU) Github Pages 使用教程 git ...

  • Mac上将本地项目上传到Github

    首先使用git上传文件到GitHub需要git客户端以及注册GitHub账号 git官网:https://git-...

  • Mac安装Git以及Git和Github使用教程

    系统环境 系统:MacOS 安装步骤 在Mac的终端上输入git检测是否安装git,如果没有,点击弹出的“安装”按...

  • Git系列之初识Git与Github

    最近好多朋友跟我说想让我写一些关于Github以及Git的使用教程,其实之前写过一篇Git基础用法详解,不过由于篇...

  • git教程 使用github

    在GitHub上,可以任意Fork开源仓库; 自己拥有Fork后的仓库的读写权限; 可以推送pull reques...

  • Git使用教程

    pycharm中配置Git教程 使用pycharm将自己项目代码上传github(小白教程)Python脚本之家 ...

  • GIT学习笔记

    参考资料 廖雪峰老师的GIT教程,以及runoob的GIT教程。 安装配置 Ubuntu/Linux使用sudo ...

网友评论

      本文标题:git以及github使用教程

      本文链接:https://www.haomeiwen.com/subject/xonmjftx.html