"Add correct host key in known_hosts" / multiple ssh host keys per hostname?

 Remove that the entry from known_hosts using:

ssh-keygen -R *ip_address_or_hostname*

This will remove the problematic IP or hostname from known_hosts file and try to connect again.

Git errors: cannot checkout branch - error: pathspec 'branch_name' did not match any file(s) known to git

 git checkout branch_name

error: pathspec 'branch_name' did not match any file(s) known to git

To fix that you can remove remote origin and link it again.

First, check the remote origin:

git remote -v
origin  git@github.com:company/project_name (fetch)
origin  git@github.com:company/project_name (push)


Then remove origin:

git remote remove origin


And add remote origin again with correct path from your repository (copy from

GitHub/GitLab/etc.):

git remote add origin git@github.com:company/project_name.git


After that run:

git pull --ff-only


And set upstream to origin branch:

git branch --set-upstream-to=origin/current_branch


Steps:

1. git remote -v
2. git remote remove origin
3. git remote add origin git@github.com:company/project_name.git
4. git pull --ff-only
5. git branch --set-upstream-to=origin/current_branch


How can I Remove .DS_Store files from a Git repository?

 Remove existing .DS_Store files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Add this line:

.DS_Store

to the file .gitignore, which can be found at the top level of your repository (or create the file if it isn't there already). You can do this easily with this command in the top directory:

echo .DS_Store >> .gitignore

Then commit the file to the repo:

git add .gitignore
git commit -m '.DS_Store banished!'

how to avoid being asked "Enter passphrase for key " when I'm doing ssh operation on a remote host?

 On Mac, add UseKeyChain to ~/.ssh/config


nano ~/.ssh/config

and add the following


Host *

    UseKeychain yes

How to Restore Eclipse Default Theme

 rm -r $WORKSPACE_DIR/.metadata/.plugins/org.eclipse.core.runtime/.settings/


And re-launch the eclipse.

Deleting Multiple Branches in Git - with wild card

 To delete many branches based on a specified pattern do the following:

  1. Open the terminal, or equivalent.
  2. Type in  for a preview of the branches that will be deleted.
  3. Type in 

Replace the <pattern> with a regular expression to match your branch names and that’s it.