美文网首页
Git基本配置

Git基本配置

作者: Codyooo | 来源:发表于2018-03-26 14:06 被阅读0次

一.绑定用户名和邮箱(告诉Git你是谁)

git config --global user.name "你的用户名"
git conifg --global user.email "你的邮箱"

二.添加SSH Key实现免密登录

1.ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
一路回车,在/C/用户/你的用户名/.ssh目录生成一对公私钥

2.eval "$(ssh-agent -s)"
检查ssh-agent是否活着

3.ssh-add ~/.ssh/id_rsa
添加私钥到ssh-agent

4.复制.ssh目录中公钥id_rsa.pub的文件内容到github上

三.创建本地仓库

git init
将当前目录初始化git本地仓库,当前目录中会生成一个隐藏目录.git(本地版本库)

git status
查看本地仓库状态(哪些文件被修改了)

git add .
将所有文件添加到暂缓区(stage)

git commit -m "提交信息
将缓存区文件变动提交的本地仓库

git log
查看commit提交日志

git diff
查看文件具体有哪些地方被修改过

git reset --hard 日志ID
回退到某个版本

git reflog
查看版本切换操作日志

git clone github远程库地址
克隆远程

四.同步远程仓库

1.登录github,新建远程库

2.git remote add origin git@github.com:Codyooo/Test111.git
将本地库和远程库绑定(只需操作1次)

3.git push -u origin master
将本地库的最新版本同步到远程仓库

相关文章

  • Git 基本使用

    基本配置命令 git config --list或git config -l:查看配置git config --g...

  • git

    基本配置 git config --list 查看配置git config --global user.name=...

  • Git 入门

    Git 下载 windows下载地址 mac下载地址 Git 配置 配置基本信息 这些配置都是在写 ~/.git...

  • Git命令整理

    Git命令 ———————————————— git配置: git基本步骤: git分支管理: 创建分支命令: 切...

  • GIt

    [TOC] 1. git安装与配置 1.1 git安装 搜索git进官网下载,安装即可! 1.2 git基本配置 ...

  • 5. Git, Github, Gitlab

    1. 实验环境 2. Git基本操作 2.1 git安装 2.2 配置git的用户名和邮箱 2.3 验证git配置...

  • 一步一步来,记全Git命令和用法

    Git基本配置 Git配置使用git config分三种,存放在不同位置 首先要配置用户名和邮箱。每次git提交都...

  • Git基本配置

    使用git 初始化一个项目并与github或者码云建立连接 git的安装就不阐述了,window和mac下各有各的...

  • Git基本配置

    一.绑定用户名和邮箱(告诉Git你是谁) git config --global user.name "你的用户名...

  • Git基本配置

    1、配置git: (1)设置用户名称和登录邮箱 git config --global user.name '用户...

网友评论

      本文标题:Git基本配置

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