【发布时间】:2019-04-30 12:18:30
【问题描述】:
我有一个本地 git repo 有一些历史。
我想将它添加到我的远程 git 服务器:
# On my server, I create a remote repo
git init project.git --bare --shared
# On my local computer, I add the remote repo
git remote add origin user@server:/srv/git/projet.git
# Try to push
git push origin master
# error: src refspec master does not match any.
# error: failed to push some refs to 'user@server:/srv/git/projet.git'
# Try to pull
git pull origin master
# fatal: Couldn't find remote ref master
# fatal: the remote end hung up unexpectedly
如果我先克隆远程仓库,然后复制源代码,我会丢失 git 历史记录。
有人知道怎么做吗?
【问题讨论】:
-
也就是说,你在本地仓库中没有分支
master,因为你没有提交任何东西,你在远程仓库中没有分支master,因为你没有' t推任何东西。
标签: git