Sometimes when trying to pull/push to a git repo, (on my own server or github), I get something like
fatal: Authentication failed for ‘https://….'”
Authentication failed
Now the problem is that I don’t even get asked for a username and password … sounds a bit stupid if you ask me.
On Windows 10:
- Press Start, (the windows key)
- Start typing “Credential Manager” or look for it in the control panel
- Then select the Windows Credentials
- Look for whatever website is the one that has your credentials
Usually something like git:http://... - Remove the entry or edit it.
If you remove it you will be asked for the credentials again.
This is a continuation of my earlier post about pruning deleted branches
To delete a local branch
git branch -d <branch_name>
or you can ‘force’ a delete if you have uncommitted changes
The -D is the same as --delete --force
git branch -D <branch_name>
To delete the branch remotely, simply do …
git push --delete <remote_name> <branch_name>
You can also do it like that if you prefer.
git push <remote_name> --delete <branch_name>
Again, you can use -d.
If you want to delete a remote and local branch, it is easier to first delete the remote branch and then the local branch.
You can then go ahead and prune all the branches.
git fetch --all --prune
When you delete a branch with git, and push those changes, you might see that your local repo still has that branch in the list
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
What this basically does is fetch all the branches and all the ones with a ‘gone’ attribute, (meaning deleted remotely), then we will remove them.
You can view the branches and what their attribute is yourself by typing
git branch -vv
Of course, you need to prune the branches on the remote git server
git remote prune origin
To make sure all is good, just re-list your branches, (local and remote)
git branch --vv -a
Recent Comments