If you are on a detached head and you want to push to your remote branch otherwise you can create a new branch and push to it ( it will be created automatically )
fatal: ‘XXX’ could be both a local file and a tracking branch. please use — (and optionally –no-guess) to disambiguate
This is definitely an edge case but easily solved. This action calls git checkout XXX, but because you have a branch, and a folder called XXX it ends up getting confused and asks you to clarify. In an attempt to solve this I’ve used git switch to specify that you want to switch to the branch specifically.
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 …
How to add image in README for GitHub
 or <img src="relative/path/in/repository/to/image.svg" width="128"/>
How to send a pull request in GitHub
Sometimes we fork a repository from GitHub and change some codes for the program we fork. How could we update the repository with our changes in local workplace? Well, we could try pull request. First, we should fork the repository into our local workplace. And normally, we want to create a new branch for specific …
How to set up GitHub in Windows
Download and install latest version of git winget install –id Git.Git -e –source winget By the way if you don’t have the winget tool, to get it first. Set username in Git Open the Git Bash $ git config –global user.name "your_user_name" Check if you set up your user name successfully git config user.name Set …
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 …
Continue reading “Permission to one repository denied to another(unwanted) git account”
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 …
Continue reading “How to use two ssh keys to access two different GitHub account.”
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 …
How should we upload files to our own branch in GitHub?
When we are working on a group project with our teammates, usually we need to complete our own part of task and upload to GitHub, but what exactly should we do? 1 . Use "git clone" to clone the files. 2. Use "git status" We can see now we are in origin/master branch. 3. Create …
Continue reading “How should we upload files to our own branch in GitHub?”