Suddenly the git push via SSH failed, and the remote server returned something like invalid format for the public key id_rsa.pub? Terminal git push Load key "/Users/username/.ssh/id_rsa.pub": invalid format [email protected]: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Last week, […]

Read more SSH – Load key “/Users/username/.ssh/id_rsa.pub”: invalid format

git clone one of my existing repo (with SSH key added in the Github), modified some files and tried to git push, and it keeps asking for username and password for git push operation? Terminal git push Username for ‘https://github.com’: Password for ‘https://github.com’: GitHub authentication is successful. Terminal ssh -T [email protected] Hi mkyong! You’ve successfully […]

Read more GitHub keep asking for username password when git push

A git pull and hits the below "reference broken" error message? Terminal $ git pull error: cannot lock ref ‘refs/remotes/origin/master’: unable to resolve reference ‘refs/remotes/origin/master’: reference broken From bitbucket.org:xx/mkyong-tutorials ! [new branch] master -> origin/master (unable to update local ref) Solution Unsure the root cause of the "reference broken". To fix it, delete this file […]

Read more Git – Unable to resolve reference ‘refs/remotes/origin/master’: reference broken

Add –allow-unrelated-histories to solve the Git fatal error – “refusing to merge unrelated histories” Terminal $ git pull origin master From https://github.com/mkyong/java-concurrency * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories To fix it : Terminal $ git pull origin master –allow-unrelated-histories From https://github.com/mkyong/java-concurrency * branch master -> FETCH_HEAD Merge made by the […]

Read more Git pull – refusing to merge unrelated histories

In Git, we can use git reset HEAD — ‘files/folders/patterns’ to remove files or folders from the staging area (Changes to be committed). 1. Case Study git add some unwanted target/*.java files, still in the staging, haven’t committed yet. Terminal $ git add project/*/*.java $ git status On branch master No commits yet Changes to […]

Read more Git – How to remove files from staging (Changes to be committed)