我的git存储库发生了一件奇怪的事情.当我尝试在tortoisegit窗口中提交某些内容时,我会收到项目中的所有文件.我不能回复他们,当我从服务器获取我收到fatal: No such ref: HEAD和fatal: Cannot lock the ref 'HEAD'.我所有的本地分支都不见了.有什么方法可以解决这个问题吗?
这不是第一次提交或其他什么.这件事突然发生了.
编辑:
git branch -a 说: Failed to resolve HEAD as a valid ref
git status 打印标记为新文件的所有项目文件.
我改变了存储库文件夹名称一段时间,当我更改它时,事情是不正确的.
我试图从github拉回一个repo并将其推送到我正在运行的gitlab服务器上的私有仓库.
我将github repo克隆到我的本地机器上
git clone https://github.com/somepage/someproject
Run Code Online (Sandbox Code Playgroud)
那时我添加了一个新的遥控器(我的gitlab)
git remote add gitlab https://mygitlabserver/mypage/myproject
Run Code Online (Sandbox Code Playgroud)
然后我推(在这种情况下只有githab上的分支开发)
git push gitlab develop
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试从我的gitlab repo克隆时,我遇到了问题:
git clone https://mygitlabserver/mypage/myproject
Cloning into 'myproject'...
remote: Counting objects: 140, done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 140 (delta 40), reused 140 (delta 40)
Receiving objects: 100% (140/140), 2.75 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (40/40), done.
Checking connectivity... done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
Run Code Online (Sandbox Code Playgroud)
不是100%的警告,但我确信它不好.如果我列出克隆目录的内容为空.
我做错了什么?
我正在关注Git Pro的书(http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server)来设置我的第一个git远程服务器Ubuntu Linux系统.我跟着这个:
$ git remote add origin git@gitserver:/opt/git/inventory.git
$ git push origin Windows
Run Code Online (Sandbox Code Playgroud)
我收到此消息:
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28,28) done.
Writing objects: 100% (33/33), 7.30 KiB | 0 bytes/s, done.
Total 33 (delta 13), reused 0 (delta 0)
To git@gitserver:/opt/git/inventory.git
* [new branch] Windows -> Windows
Run Code Online (Sandbox Code Playgroud)
但是当我git status在远程服务器上键入时(在/opt/git/inventory.git/中),我收到错误消息fatal: This operation must be run in a work tree
远程存储库似乎不包含本地存储库中的任何文件,当我将远程存储库克隆到不同的本地文件夹时,没有文件,只有.git文件夹.
我在这里看了其他相关问题:
但我不清楚为什么会这样,以及我可以做些什么来弥补它.