git推送远程仓库

1. 检查推送的分支

复制代码
# 查看当前分支和远程分支
git branch -a
git remote -v

2. 可能推错了分支

复制代码
# 查看所有分支的推送状态
git log --oneline -5
git status

# 强制推送(谨慎使用)
git push -u origin main
# 或
git push -u origin master

3. 检查是否真的提交了文件

复制代码
# 查看提交历史
git log --oneline

# 检查暂存区状态
git status

# 如果文件没有提交
git add .
git commit -m "提交说明"
git push

4. 验证远程仓库配置

复制代码
# 检查远程仓库地址是否正确
git remote -v

# 如果地址不对,重新设置
git remote set-url origin https://gitee.com/你的用户名/仓库名.git

5. 检查 Gitee 仓库设置

  • 登录 Gitee,确认:

    • 仓库是否创建成功

    • 查看的是正确的分支(main/master)

    • 仓库不是空仓库提示状态

6. 完整的推送流程

复制代码
# 重新执行完整流程
git add .
git commit -m "添加项目文件"
git push -u origin main
相关推荐
BIBI20499 小时前
换 Git 托管平台怎么做?基于 TortoiseGit 的跨平台迁移教程
windows·git·tortoisegit·问题解决·版本控制·最佳实践
echome88816 小时前
Git 日常救急:撤销提交、找回误删文件和解决冲突
git·版本控制
赵民勇21 小时前
Git命令详解
git
不老刘2 天前
Antigravity 的 New Worktree 模式:给 AI 代理一个安全的“平行工位”
人工智能·git·ai编程·antigravity
光谱SpectrAI2 天前
Windows 也中招:Git Bash 和 Node 仍信任泄露的 eMudhra 证书
git
YIN_尹2 天前
【git原理与使用】git初识与安装
大数据·git·elasticsearch
Leo_Mr2 天前
Vue3 项目配置 Git 提交规范(企业通用方案:husky + commitlint + cz-git + lint-staged)
git
jyOverQ2 天前
Git rebase 和 merge 有什么区别?什么时候该用哪个?
git
晗夜未央2 天前
跨仓库 Skill 换台电脑就失效?用 Git remote 校验项目
人工智能·git·python
Lsetea2 天前
Git访问HTTPS证书不受信任:用URL级sslCAInfo限定私有CA范围
git·https·开发工具·ssl证书·ca证书