我正在尝试提交从GitHub克隆的本地存储库。我收到以下错误消息
var imgUrl = $("#image").prop("style", "background-image");
.git文件夹的结构如下所示:
来自fatal: update_ref for ref 'HEAD': cannot lock ref 'HEAD': ref
refs/heads/master is at 2b459....[LOTS OF NUMBERS AND CHARACTERS]...
but expected 000000000000000000000000000
的输出:
git status
从warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: src/actions/types.js
new file: src/components/auth/require_auth.js
new file: src/components/auth/signin.js
new file: src/components/auth/signout.js
new file: src/components/auth/signup.js
new file: src/components/feature.js
new file: src/components/header.js
new file: src/components/welcome.js
new file: src/reducers/auth_reducer.js
new file: style/react-bootstrap-table-all.min.css
输出:
git log --all --oneline --decorate --graph
* 1d2e02d (HEAD) First working version
* 2b459d6 (HEAD -> master, origin/master, origin/HEAD) Create .babelrc
* a7b92d5 Merge branch 'master' of github.com:StephenGrider/ReduxSimpleStarter
|\
| * 29ebda4 Merge pull request #8 from megadix/master
| |\
| | * 7a74747 Filter out IntelliJ IDEA project files in .gitignore
| * | decca90 Merge pull request #10 from dkarter/master
| |\ \
| | * | 94692d5 Use destructuring to import Component
| | |/
| * | ff4d48c Merge pull request #24 from tsurupin/add-global-navigator
| |\ \
| | * | d976e01 Add global navigator setting to modify the error, 'navigator is not defined', in testing with react-router link
| * | | b198de2 Merge pull request #29 from hex13/master
| |\ \ \
| | |/ /
| |/| |
| | * | 6246c47 fix typo in README.md
| |/ /
* | | c62b60e moved babel config to webpack
|/ /
* | 2eba18e (tag: 1.1.0) added reactrouter
* | 3ea279e Update package.json
* | 78c0fed tweak mocha test command for windows users
|/
* 3f36bba added test boilerplate and helpers
* 3441a8e Update README.md
* 92d5200 absolute script and css paths
* 81cee14 move history fallback to webpack server config
* 2cd850b using history fallback
* 31208bf Update README.md
* c5ad6ad Update README.md
* 0c7231d Update README.md
* 6aedde6 fix npm start on windows machines
* ec41961 Create README.md
* 7afaf3a added google maps by default
* 0736160 add lodash
* f6a7716 use store with middleware
* 14813f8 middleware setup included by default
* 1b82228 (tag: 1.0.0) Merge branch 'master' of github.com:StephenGrider/ReduxSimpleStarter
|\
| * fe018bf add default reducer
* | 3aa34af added css
|/
* e4c4496 state-1 -> stage-1
* 4709b14 added babel preset
* 05173d9 used class container as root node
* 148f186 added bootstrap
* 9128a89 code cleanup
* dd358d4 reorder imports
* 3f0e441 update default text
* 9eff420 action and reducer setup
* 246b131 added redux
* f71dda3 add react redux and redux
* 544ddfd update repository field
* dedb285 update package.json
* dff784d initial commit
git branch --all
我在运行 HEAD
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
输出现在看起来像:
git branch -D HEAD
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 directory clean
git log --all --oneline --decorate --graph
* 8a21399 (HEAD -> master) First working version (from git-gui)
* 2b459d6 (origin/master, origin/HEAD) Create .babelrc
* a7b92d5 Merge branch 'master' of github.com:StephenGrider/ReduxSimpleStarter
|\
| * 29ebda4 Merge pull request #8 from megadix/master
| |\
| | * 7a74747 Filter out IntelliJ IDEA project files in .gitignore
| * | decca90 Merge pull request #10 from dkarter/master
| |\ \
| | * | 94692d5 Use destructuring to import Component
| | |/
| * | ff4d48c Merge pull request #24 from tsurupin/add-global-navigator
| |\ \
| | * | d976e01 Add global navigator setting to modify the error, 'navigator is not defined', in testing with react-router link
| * | | b198de2 Merge pull request #29 from hex13/master
| |\ \ \
| | |/ /
| |/| |
| | * | 6246c47 fix typo in README.md
| |/ /
* | | c62b60e moved babel config to webpack
|/ /
* | 2eba18e (tag: 1.1.0) added reactrouter
* | 3ea279e Update package.json
* | 78c0fed tweak mocha test command for windows users
|/
* 3f36bba added test boilerplate and helpers
* 3441a8e Update README.md
* 92d5200 absolute script and css paths
* 81cee14 move history fallback to webpack server config
* 2cd850b using history fallback
* 31208bf Update README.md
* c5ad6ad Update README.md
* 0c7231d Update README.md
* 6aedde6 fix npm start on windows machines
* ec41961 Create README.md
* 7afaf3a added google maps by default
* 0736160 add lodash
* f6a7716 use store with middleware
* 14813f8 middleware setup included by default
* 1b82228 (tag: 1.0.0) Merge branch 'master' of github.com:StephenGrider/ReduxSimpleStarter
|\
| * fe018bf add default reducer
* | 3aa34af added css
|/
* e4c4496 state-1 -> stage-1
* 4709b14 added babel preset
* 05173d9 used class container as root node
* 148f186 added bootstrap
* 9128a89 code cleanup
* dd358d4 reorder imports
* 3f0e441 update default text
* 9eff420 action and reducer setup
* 246b131 added redux
* f71dda3 add react redux and redux
* 544ddfd update repository field
* dedb285 update package.json
* dff784d initial commit
git branch --all
git版本2.7.4,我正在运行Ubuntu 16.04
如何解决此问题?
答案 0 :(得分:1)
错误是因为存储库有一个名为HEAD
的分支。由于HEAD跟踪当前工作提交,因此Git在名为HEAD的分支和git的当前工作提交的内部指针之间变得混乱(因此warning: refname 'HEAD' is ambiguous
消息。)
您可以尝试git branch -D HEAD
(删除分支的正常方法),但我不确定这是否会让git更加混乱。