上传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 即可。

相关推荐
修己xj3 小时前
解决Github QQ邮箱注册难题:绕过“Unable to verify your captcha response”错误
github
AI首席情报员_阿布6 小时前
2026 GitHub 最火的 10 个 AI Agent 框架:普通开发者的选型指南
github
阿里嘎多学长11 小时前
2026-01-11 GitHub 热点项目精选
开发语言·程序员·github·代码托管
三两肉11 小时前
HTTPS ECDHE 握手全解析
网络协议·https·github·rsa·echde
啊湘12 小时前
vscode 使用 github (适用CURSOR等使用)
ide·vscode·github·cursor·mcp
l1t13 小时前
利用DeepSeek辅助拉取GitHub存储库目录跳过特定文件方法
人工智能·github·deepseek
Hilaku13 小时前
我用 Gemini 3 Pro 手搓了一个并发邮件群发神器(附源码)
前端·javascript·github
逛逛GitHub15 小时前
GitHub 上 2300 人 Star 的 Claude Code 可视化工作流编辑器。
github
这儿有一堆花15 小时前
MusicFree:开源多平台聚合音乐软件
开源·github