I\'m trying to learn how to use Git and have created a small project with an HTML, CSS, and Javascript file. I made a branch from my basically empty project and then made so
It may be happening your branch is corrupted create new branch git branch #check branch. I have created a new branch and working .
branch -b "main"
git checkout -b "main" #main is new branch
git add .
git commit -m "all files"
git remote add origin #**YOUR REPO** https://github.com/tarun-techmarbles/wp-dump-sql-git-push.git
git push origin main #push with new branch
I faced same problem. I had to do little more to resolve this. First I deleted index.lock
then I cloned fresh code from existing git repository location. I had my code changes in seperated location. I copiped .git
folder and .gitignore
file and pasted in the code folder where I had made code changes.
Then I tried to commit and push, it worked smoothly.
May be this impormation will be helpful if your problem doesn't by above given solutions.
Though there is an alternative above, but that didn't solve mine. In my case, I delete the "git" plugin in ./zshrc and reboot the computer then the issue is gone, I guess the zsh plugin had done something conflict the original git command.
If you are on PowerShell, use
rm -Force .git/index.lock
I have same faced issues when i tried to staged file in SourceTree.
To solve this go to the .git folder in the project directory and manually delete index.lock and you are done.
If you wind up here based on the question's title ("Another git process seems to be running in this repository"), note that the accepted answer will not be directly applicable to you if the message in this question's title is preceded by another message like the one below:
fatal: cannot lock ref 'HEAD': Unable to create '/<PATH>/<TO>/<REPO>/.git/refs/heads/<BRANCH>.lock': File exists.
In this case, you should delete that file(.lock) instead of .git/index.lock