上传GitHub步骤(自用版)

步骤

1、在所需上传至GitHub的文件夹里打开Git Bash,输入git init,将文件夹初始化为仓库;

2、在该文件夹里"右键-用VSCode打开",在VSCode里"查看-终端-切成Git Bash",后续在这里输入命令;

3、目前文件都是在【工作区】,通过 git add -A 将所有文件从【工作区】移到【暂存区】,即从"更改"->"暂存的更改";

4、输入 git commit -m "提交信息" ,从【暂存区】移到【仓库】;

5、在GitHub中新建一个仓库,并复制其网页地址https://github.com/xxx;

6、依次输入命令 git remote add origin https://github.com/xxx.git、git branch -M main、git push -u origin main。

常见报错解决

如果第6步报认证的错(fatal: Authentication failed...),输入命令 git config --global user.email xxx@qq.com

如果报连接的错(Failed to connect to github.com port 443 after 32192 ms: Could not connect to server)

  • 首先,打开设置 -> 网络和Internet -> 代理,找到代理设置,并记录当前代理端口,假设端口号为1234
  • 输入命令 git config --global http.proxy http://127.0.0.1:1234 和 git config --global https.proxy http://127.0.0.1:1234(这里要跟端口号对应上)
  • 然后再 git push origin main 即可

如果报错error: failed to push some refs to,输入命令 git pull --rebase origin main 和 git push origin main 即可。

相关推荐
研究点啥好呢7 小时前
Github热门项目推荐 | 创建你的像素风格!
c++·python·node.js·github·开源软件
无限进步_9 小时前
【C++】电话号码的字母组合:从有限处理到通用解法
开发语言·c++·ide·windows·git·github·visual studio
MicrosoftReactor9 小时前
技术速递|使用 Copilot SDK 构建 AI 驱动的 GitHub Issue 分类系统
人工智能·github·copilot
AI成长日志9 小时前
【GitHub开源项目专栏】AI推理优化框架深度解析(上):vLLM架构设计与核心实现
人工智能·开源·github
CV-deeplearning9 小时前
【开源】字节跳动开源 DeerFlow 2.0:一站式 SuperAgent 开发框架,GitHub 星标 5.9 万!
开源·github·deerflow·deerflow 2.0·superagent
Freak嵌入式10 小时前
MicroPython LVGL基础知识和概念:显示与多屏管理
开发语言·python·github·php·gui·lvgl·micropython
zandy101111 小时前
【全新 3.0版本】openclaw github installation guide
github·openclaw·installation
Freak嵌入式11 小时前
MicroPython LVGL基础知识和概念:时序与动态效果
开发语言·python·github·php·gui·lvgl·micropython
北冥有羽Victoria12 小时前
OpenCLI 操作网页 从0到1完整实操指南
vscode·爬虫·python·github·api·ai编程·opencli
Thomas.Sir13 小时前
GitHub Copilot从入门到精通【从基础补全到智能代理,解锁AI编程全技能】
github·copilot·ai编程