码云GIT推送失败 - the remote end hung up unexpectedly Connection to gitee.com closed by remote host

时间:2024-04-02 20:35:43

前言

以前直接是在码云上新建了一个私有库,在直接git clone xxx下来的,现在git push不了。

 

错误提示

Your branch is based on 'origin/xxxx', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)

git push -u origin master
fatal: the remote end hung up unexpectedly
Connection to gitee.com closed by remote host.

git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean

 

解决办法

  1. 先把整个项目目录备份起来
  2. 删掉这个目录
  3. mkdir Name-of-your-Project
  4. cd Name-of-your-Project
  5. git init
  6. git remote add origin [email protected]:XXX/project.git
  7. git pull
  8. git status
  9. 把备份里面需要的文件都扔进来,git add . >> git commit -m "XXX" >> git push -u origin master
  10. ok

 

码云GIT推送失败 - the remote end hung up unexpectedly Connection to gitee.com closed by remote host