栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Github基础指令-本地文件的上传与仓库管理

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Github基础指令-本地文件的上传与仓库管理

  1. github账号注册 https://github.com/
  2. 下载安装git工具 https://git-scm.com/
  3. 配置账户,打开git bash
git config --global user.name 'your_username' #设置用户名
git config --global user.name 'your_email' #设置github邮箱
  1. 连接到Github账户
    i) 生成密钥
ssh-keygen -t rsa -C 'your_email' #接着按3个回车

ii) 将 C盘/用户/.shh 目录下id_ras.pub文件内容复制,粘贴到GitHub设置中的SSH密钥中


iii) 验证是否成功认证

ssh -T git@github.com

  1. 新建仓库(Github页面)

  2. 克隆仓库
    i) 复制仓库链接

    iii) 选择一个文件夹作为本地仓库,并 右键-Git Bash Here

git clone https://github.com/wodaka/new-repository.git

此操作会在当前文件夹下新建new-repository文件夹,并将远程仓库new-repository中的文件拷贝到new-repository文件夹中
7. 更新文件
i) 进入new-repository文件夹,右键-Git Bash Here
在文件夹中增加新文件后,利用如下命令上传新文件到远程仓库

git add .  #提交所有文件
git commit -m 'add files' #引号中为提示信息
git push -u origin master #推送到远程仓库
  1. 删除文件
git rm 'example.txt' #删除文件,引号中为文件名
gir rm -r 'example folder' #删除文件夹
git commit -m 'delete' 
git push -u origin master 
  1. LF will be replaced by CRLF问题解决
    在push到远程仓库之前,使用如下代码
git config --global core.autocrlf false

参考链接
[1]简单使用Git和Github来管理自己的代码和读书笔记
[2]Github 生成SSH秘钥(详细教程)
[3]git与github账号绑定
[4]Git基本操作
[5]GIT代码管理: git remote add
[6]git 命令删除文件操作
[7]git push -u 用法
[8]warning: LF will be replaced by CRLF问题解决方法

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/320113.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号