0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

GitHub的使用

jf_96884364 来源:jf_96884364 作者:jf_96884364 2023-01-10 16:33 次阅读

创建新项目

在GitHub创建新项目:

创建Git文件

(1)在需要上传的目录打开powershell

(2)执行命令创建隐藏的.git文件:

git init

添加用户

项目的.gitconfig文件最后加入

[user]
    name = name 
    email = email

否则会出现以下报错:

Commit failed - exit code 128 received, with output: '*** Please tell me who you are.

Run

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

添加到Git

分别执行add、commit,具体参考 Git的使用

(1)add/rm

添加全部文件:

git add -A

添加单个文件:

git add env.txt

删除某个文件:

git rm env.txt

git add -A 表示添加所有内容, git add .表示添加新文件和编辑过的文件不包括删除的文件; git add -u 表示添加编辑或者删除的文件,不包括新添加的文件。

(2)commit

对修改的描述

git commit -m "new"

关联仓库

将本地仓库关联到github上,XXX为仓库名

git remote add origin https://github.com/Snowstorm0/XXX.git

Push

push到github:

git push -u origin master

常见报错

(1)add 时 报错:

warning: LF will be replaced by CRLF in XXX

换行符错误,在windows下使用以下代码修改:

git config --global core.autocrlf true

(2)add 时 报错:

fatal: not a git repository (or any of the parent directories): .git

重新添加git:

git init

(3)commit 时 报错:

Commit failed - exit code 128 received, with output: '*** Please tell me who you are.

Run

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

需要到项目的.gitconfig文件最后加入

[user]
    name = name 
    email = email

(4)commit 时 报错:

fatal: could not open '.git/COMMIT_EDITMSG': Permission denied

对于Windows系统可以进入.git文件(隐藏文件)删除“COMMIT_EDITMSG”文件即可

(5)push 时 报错:

fatal: unable to access 'https://github.com/Snowstorm0/': OpenSSL SSL_read: Connection was aborted, errno 10053

Git默认限制了push的大小,更改限制即可:

git config --global http.postBuffer 524288000

审核编辑:汤梓红

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 文件
    +关注

    关注

    1

    文章

    541

    浏览量

    24467
  • C++
    C++
    +关注

    关注

    21

    文章

    2070

    浏览量

    73024
  • GitHub
    +关注

    关注

    3

    文章

    458

    浏览量

    16056
收藏 人收藏

    评论

    相关推荐

    59.Github 被黑了?No Access?Why?

    GitHub
    充八万
    发布于 :2023年07月11日 23:15:16

    github的使用

    ”Creating Repository”按钮,即创建了版本仓库。 接下来,在本地安装git客户端。一、到官网下载客户端:https://github
    发表于 04-16 16:00

    【NanoPi NEO试用体验】github使用教程

    Github使用入门教程,资料 github.com/friendlyarm
    发表于 10-29 07:23

    github是什么_github有什么用

    gitHub是一个面向开源及私有软件项目的托管平台,因为只支持git 作为唯一的版本库格式进行托管,故名gitHubgitHub于2008年4月10日正式上线,除了git代码仓库托管
    发表于 11-29 16:19 2w次阅读

    github使用教程_github菜鸟教程

    GitHub 拥有一个非常鼓励合作的社区氛围。这一方面源于 GitHub 的付费模式:私有项目需要付费,而公共项目完全免费。这意味着 GitHub 上的大多数项目都是开源的,任何用户都有海量的开源项目选择可用来分支学习和贡献代码
    发表于 11-29 17:22 1.5w次阅读
    <b class='flag-5'>github</b>使用教程_<b class='flag-5'>github</b>菜鸟教程

    干货:如何定制自己的 GitHub 首页

    前段时间 GitHub 出了一个功能,可以定制自己的 GitHub 首页。比如我的首页 https://github.com/polaris1119 之前是这样的:
    的头像 发表于 10-08 09:54 2705次阅读

    九招教你提高国内访问GitHub速度

    GitHub 镜像访问 GitHub文件加速 Github 加速下载 加速你的 Github 谷歌浏览器 GitHub 加速插件(推荐)
    的头像 发表于 09-29 15:15 1843次阅读
    九招教你提高国内访问<b class='flag-5'>GitHub</b>速度

    如何获取和使用Github上的开放资源

    自从 Vitis 发布后,Xilinx 在 Github 上持续开源了很多资源,方便开发者进行自己的设计,减少产品上市时间。所以本期文章我们来看下如何获取和使用 Github 上的开放资源。
    的头像 发表于 04-09 11:51 3266次阅读
    如何获取和使用<b class='flag-5'>Github</b>上的开放资源

    GitHub入门与实践

    GitHub入门与实践
    发表于 11-21 10:40 0次下载

    Refined GitHub简化GitHub界面并实用的浏览器扩展

    ./oschina_soft/refined-github.zip
    发表于 05-18 15:48 0次下载
    Refined <b class='flag-5'>GitHub</b>简化<b class='flag-5'>GitHub</b>界面并实用的浏览器扩展

    GitHub VSC在浏览器中使用VS Code操作GitHub仓库

    ./oschina_soft/github-vsc.zip
    发表于 05-18 14:23 0次下载
    <b class='flag-5'>GitHub</b> VSC在浏览器中使用VS Code操作<b class='flag-5'>GitHub</b>仓库

    GitHub Notifier Github通知显示

    ./oschina_soft/github-notifier.zip
    发表于 05-23 10:51 3次下载
    <b class='flag-5'>GitHub</b> Notifier <b class='flag-5'>Github</b>通知显示

    github-gmail Github通知邮件

    ./oschina_soft/github-gmail.zip
    发表于 05-23 10:48 1次下载
    <b class='flag-5'>github</b>-gmail <b class='flag-5'>Github</b>通知邮件

    github-profile-summary GitHub资料​可视化展示工具

    ./oschina_soft/github-profile-summary.zip
    发表于 06-13 09:55 1次下载
    <b class='flag-5'>github</b>-profile-summary <b class='flag-5'>GitHub</b>资料​可视化展示工具

    RT-Thread中的Github Actions

    RT-Thread中一共有五个Github Action(rt-thread/.github/workflow) 分别是: RT-Thread BSP build check(.github
    的头像 发表于 06-01 03:10 408次阅读
    RT-Thread中的<b class='flag-5'>Github</b> Actions