Git detached head

Most of the time, HEAD points to a branch name. When you add a new commit, your branch reference is updated to point to it, but HEAD remains the same. When you change branches, HEAD is updated to point to the branch you’ve switched to. All of that means that, in these scenarios, HEAD is …

Permission to one repository denied to another(unwanted) git account

My personal solution to solve this problem is: 1. Check the credentials ssh -T git@github.com The name printed out should be your wanted user name. If not, go step 2. 2. Connect ssh. cd ~/.ssh 3. Connect to wanted ssh ssh-add ~/.ssh/id_rsa_account1 4. Check the connected ssh list ssh-add -l If there shows your wanted …

How to use two ssh keys to access two different GitHub account.

I tried to use two ssh keys for my two GitHub accounts, one for my personal account, one for my school account. However, I screwed the ssh credential for GitHub verification. When I tried to use my personal account to push my code, I got permission denied A-account@git.com to B-account. I took some time searching …

Some notes on Git

Basic: Create a repository: git init Add files to repository to be committed: git add filename1 filename2 ( add files to stage) Make files committed git commit -m "xxx" (commit files to branch) Check the result git status Version Control: Compare the difference git diff filename Show history git log or git log –pretty=oneline Back …