前言
以前直接是在碼雲上新建了一個私有庫,在直接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