前言
以前直接是在码云上新建了一个私有库,在直接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
解决办法
- 先把整个项目目录备份起来
- 删掉这个目录
- mkdir Name-of-your-Project
- cd Name-of-your-Project
- git init
- git remote add origin [email protected]:XXX/project.git
- git pull
- git status
- 把备份里面需要的文件都扔进来,git add . >> git commit -m "XXX" >> git push -u origin master
- ok