This one threw me off but here is how you would typically run into such a problem. It is especially true if you are mostly using Git via command line.
- You have a remote branch located at feature/INT-4765-bad-things-predictor
- You are using git via command line.
- You are working on Windows.
So here is what you do:
- You check out the repository by typing
- git checkout feature/int-4765-bad-things-predictor.
- You make some changes to this new local repository.
- Then you run a the git add and commit commands to stage the changes readying them to be pushed to the remote.
- Then you attempt to push the changes and you are welcomed with an error which resembles this:
remote: error: failed to lock refs/heads/feature/int-4765-bad-things-predictor To http://firstname.lastname@example.org:7990/scm/int/home-reno-mentor.git
! [remote rejected] feature/int-4765-bad-things-predictor -> feature/ INT-4765-bad-things-predictor
error: failed to push some refs to ‘http://email@example.com:7990/scm/int/home-reno-mentor.git’
This error does not say much but thanks to Google, the first link presented if you search for “git failed to lock ref” is this StackOverflow listing. Basically this is an overly convoluted (if you will) message just to tell me remote repository cannot be found.
The problem here lies with Git on Windows’ case sensitivity. A branch named feature/INT-4765-bad-things-predictor with Git implementation on Windows is apparently not the same as feature/int-4765-bad-things-predictor. Hint: case sensitivity.
To fix this problem, I did two things:
- Navigated to the actual branch path on my local machine and capitalized the name to match that on the remote box.
- Re-ran git checkout with the branch name, exactly as it appears on remote, respecting case such as git checkout feature/ INT-4765-bad-things-predictor
- This should resolve this issue and allow you to push your changes to the remote.