I always got cannot lock ref 'refs/remotes/origin/master'
when I execute git pull
first time if there are some updates.
The full console log is belows.
D:\code\react-native\expo-multi-screen-starter>git pull
error: cannot lock ref 'refs/remotes/origin/master': is at b2459b4d5af42622cba55f9fe47ccd14fbd879bc but expected 76f11048c866cfe3e6570eaacf90db3cb7732723
From github.com:liudonghua123/expo-multi-screen-starter
! 76f1104..b2459b4 master -> origin/master (unable to update local ref)
D:\code\react-native\expo-multi-screen-starter>git pull
App.js | 19 ++++-----
src/navigation/AuthStack.js | 14 +++++++
src/navigation/RootNavigator.js | 22 ++++++++++
src/navigation/TabNavigator.js | 4 +-
src/screens/AuthLoadingScreen.js | 35 ++++++++++++++++
src/screens/HomeScreen.js | 19 +++++++++
src/screens/{LoginScreen.js => SignInScreen.js} | 54 ++++++++++++++++++++++---
7 files changed, 147 insertions(+), 20 deletions(-)
create mode 100644 src/navigation/AuthStack.js
create mode 100644 src/navigation/RootNavigator.js
create mode 100644 src/screens/AuthLoadingScreen.js
rename src/screens/{LoginScreen.js => SignInScreen.js} (61%)
D:\code\react-native\expo-multi-screen-starter>
Update local repository We need to remove branches that are no longer in the remote repository. Execute the following command. It removes all branches from the local repository that have gone from the remote repository. Try to execute git pull or git fetch .
Solution. Unsure the root cause of the "reference broken". To fix it, delete this file . git/refs/remotes/origin/master , and git fetch to retrieve it back.
Git fetch summary In review, git fetch is a primary command used to download contents from a remote repository. git fetch is used in conjunction with git remote , git branch , git checkout , and git reset to update a local repository to the state of a remote.
You need to update the reference using following Git command on Git bash:
$ git update-ref -d refs/remotes/origin/[locked branch name]
then pull using $git pull
[locked branch name]
is the name of the branch that the error is happening because of mismatch of commit Ids.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With