GitHub Basics: Discover 18 Common Problems and Possible Fixes
Last Updated: August 4, 2025

To install Git you can follow the steps based on your operating system:
ssh-keygen -t rsa
Once upon a time, I used a single file to save the keys, then it took a bug to the content and it got corrupted. The result was that I had to go to all the web apps and replace the key. This can be a hassle if you use git with multiple different hosted repositories.
If you are creating different keys for different remote web applications ( GitHub, BitBucket, and so on… ) it’s easier for you to handle and have better control over it. When a key expires, you can delete and easily replace only that key for the specific web application.
This is a fun one and there are 2 possible issues. This can happen when you have multiple keys.
git config core.sshCommand ‘ssh -i ~/.ssh/‘
Then type:
eval “$(ssh-agent -s)”
Now, open the git client and try again. Opening and closing of Git client will make it reload the git config file.
It’s possible to have ties with multiple remote repositories from the same or different platforms. Using the terminal to add a repository URL, you will have to declare an alias for the URL.
Example: “git remote add origin git@somedomain.com/something/something.git”
The word “origin” is just an alias, you can name it however you want. Once I have added this to the git configuration file with the terminal, I can add more remote aliases with different URLs.
Example: “git remote add wpriders git@domain2.com/potato.potato.git”
This will allow you to configure a second remote repository URL for the same source code…and so on. The config file data will look something like this:
[remote “origin”]
url = git@wpriders.git.beanstalkapp.com:/wpriders/wpriders_theme.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote “wpriders”]
url = git@domain2.com/potato.potato.git
fetch = +refs/heads/*:refs/remotes/wpriders/*
To define your full name globally for all git repositories use the following terminal command.
git config –global user.name “John Doe”
To check that it was saved, use the following command
git config –global user.name
In a similar manner, you can set the email:
git config –global user.email “youremail@yourdomain.com”
Run “git config –list” to check that it was saved. ( press Q to quit )
To only add these credentials to a local repository, use the same commands but without the word “global”
Use a text editor to open and edit your files with Git. This command is for all OS to set Visual Studio Code as the default editor:
git config –global core.editor “code –wait”
I for one like to set up the remote Git repository URL by terminal, pull the code, and then open it with a Git client APP. There are a lot of free and premium Apps, SourceTree is a free client Git APP and easy to use.
How to set up a git repository from zero using the terminal:
git init
git remote add origin git@domain.com:/folder/reponame.git
git pull origin master
The URL info is normally offered by the repository. Avoid using anything other than Git links, like HTTP link types.
On GitHub, you can also use their Git-CLI.
Remember that SSH (tab) repository link will only show up if you are authenticated ( especially on GitHub )
In this case, you will have to set it up on the hosting at your disposal, be it GitHub, Bitbucket, BeanstalkAPP, and so on. After you create the repository on the platform of choice or need, the next step is to upload the code from your local repository.
git init
git remote add origin git@domain.com:/folder/reponame.git
This is the most used option.
Using a visual Git client ( SourceTree ), make sure you have committed everything to the branch you are currently working on.
Let’s use the following example: Working branch name “task-122-issue-with-meta” ( alias branch beta )
Main branch where you want to merge branch beta is named “master” or “main” ( alias alpha branch ).
We have just committed our changes to the beta branch, as for the next step is to switch to the alpha branch ( checkout alpha branch ).
Use the mouse to right-click on the beta branch after switching to the alpha branch and you will see an option “Merge beta branch into alpha branch”.
This option is not a merge action but a way to move parts of the code between branches.
This option will only work with a code editor. For the next example, we will be using PHPStorm.
Similar to the above example we check out the alpha branch. Open the Git menu and click on the logs tab if not already selected.
Use the mouse right-click on beta and you should see an option named “Show diff with working tree”. After selecting the option, a list of files will be displayed, these files are the ones that have differences between branches. If the beta branch has a file that you want in alpha branch, right-click on the file and use the option “Get from branch”. This will copy the file from the beta branch to the alpha branch.

If you open the file with a double left click, you will be able to move parts of the code from the beta to alpha with ease. You can use the arrows to move the code or you can just copy-paste it from beta to alpha with no restrictions, but not from alpha to beta. This can also be used to solve conflicts as it allows you to edit the current branch code.
This method also allows you to get only parts of the code from any branch to the current branch, in case you need something from a different branch but that branch is not done yet so it’s not merged in the main branch.
We merged 2 branches and we got the message that there are conflicts. One option is to use PHPStorm or VSCode ( or other advanced code editors that have similar functionalities ). If we open the project in PHPStorm, we will see the files that have conflicts marked with a color, usually red/orange.
On any of these files, right-click to see the options, and navigate to the Git submenu, only the affected files will have a submenu called “Merge conflicts”. A new window or file list will display only the files that have conflicts. Opening those files ( by selecting the file and clicking Merge ) will allow you to visually select which changes to move from branch B to branch A or copy-paste the changes manually.
In some cases, it’s easier to copy-paste just parts of code. If you are working with another developer on the project and you are confused about which version is the latest or the good version of a class/function when solving the merge conflict, just contact them and discuss it. In rare cases maybe both of you made changes to the same function and the final version will require both changes, then just manually copy parts of the code required from branch B to branch A ( you will not be able to copy-paste from branch A to B ) Another option is to use the option “Show diff with working tree” which was described previously.
Maybe you have more time or maybe you need to research for the best solution regarding an issue. You create a branch from the main ( latest ) branch which has the latest code.
After reaching a certain point and after modifying multiple files you want to start from scratch, but don’t want to create multiple branches just for the sake of it and also you do not want to lose the changes you have made in the current branch,
The solution is to create a Git Stash. The main point is to not commit the changes to git. Select the uncommitted selection and look for the option “Stash”, for example, SourceTree has a button at the top menu for it.
The APP will request a name for the stash, and input relevant keywords, you want to figure out what the stash contains at first glance.
All the uncommitted code since you started working will be saved into this stash and it will be removed from the branch itself.
Your branch will look like no changes have been made to it since its last commit.
You can start working on a different solution and create another stash later to save the code you wrote. Stashes can be applied to any branch and can be accessed at any time, you can even see which files were affected and which code was changed. You can copy-paste code from a stash if you do not need the whole stash.
If you apply the entire stash, a new prompt will appear on the screen asking you if you want to delete the stash after it is applied. If you want to delete it or keep it, it is up to you. I usually keep them until it’s very clear to me that I do not need them.
A stash is being saved only locally and not online. There are some unconventional ways to save them online as temporary branches or you create multiple branches and apply the stash, each stash with its own branch, but this might take a while at some point.
Just remember that these are not permanent, if something happens to your local Git, they are gone. Well, this has a low chance of happening, but it’s better to know in advance.
Using SourceTree you can right-click on a commit and select copy SHA/hash.
You will need two hash items to get the full list of files changed/added/deleted in between.
We will use the example:
Latest commit = C1
5 commits back ( including C1 ) = C5
6 commits back ( including C1 ) = C6 or C5+1

You need the list of files between C1 and C5.
You will need the hash of C1 and C5+1
Open the terminal in the project Git root, where the folder .git is also located.
Run the following terminal command:
git diff –name-only SHA1 SHA2 or git diff –stat SHA1 SHA2
This can only be used before making the commit.
Some files in your working directory may be tracked by git, meaning that Git knows about them and records their history. Other files may be untracked, meaning that Git does not know about them and ignores their changes.
To check if a file is tracked or untracked, you can use the `git status` command, which will show you the state of your working directory and the staging area.
You can also use the `git ls-files -v` command to list all the tracked files in your working directory.
git update-index –assume-unchanged
To add it back to the index/tracking, for git to see file changes again, run the command.
git update-index –no-assume-unchanged
This command is handy for local configuration files that you don’t want to accidentally commit. However, be cautious, as this could lead to conflicts if updates to these files are made in the remote repository.
For folders we have different commands:
git ls-files -z / | xargs -0 git update-index –assume-unchanged
And
git ls-files -z / | xargs -0 git update-index –no-assume-unchanged
Some of the git commands have multiple parameters that can be fixed for what you need and it’s hard to remember all of the parameters. If you are using “Oh My ZSH” https://ohmyz.sh/ then it’s very easy to create an alias for any command, complex or not.
After installing ZSH ( MacOS/Linux ), in your home directory, you will find a file named “.zshrc” and you can open it with any editor as it is considered a text file.
In the file you will see some examples of aliases:

# Example aliases
# alias zshconfig=”mate ~/.zshrc”
# alias ohmyzsh=”mate ~/.oh-my-zsh”
I will create a new alias
alias gstat=’git status’
After creating an alias, restart terminal. Now if I run the command in the terminal “gstat”,
it will run the command “git status”.
This only applies if you have to create the git repository for a project.
If the project already exists, it’s already decided where the git root is located.
It’s better to use the WordPress root folder, where wp-config.php is located, as git root. Even if you only work on a plugin for this project or a theme.
After creating the git root in the WP root directory, you need to add to the list of git ignore every folder/file that is not related to your work.
If later you need to create a new plugin for this project or a child theme, you can have them on the same repository just for the simple reason that your git root is in the WP root.
If you created the git root in the plugin/theme directory root then you will not be able to add any other plugin/theme to the repository as these will not be visible.
If your project requirement is clear that it’s only a plugin/theme that you maintain frequently, or add features to, and it does not belong to any WordPress project, it’s better to have the git root in the plugin/theme root folder.
You can specify after adding both or X remote repositories links to the git configuration. You need to open the config file with a text editor from .git folder in the project.
You can specify which SSH key to use for each remote repository by adding this line for each remote repository link instead of [core].
sshCommand = ssh -i ~/.ssh/
In the end, it would look like this
[remote “origin”]
url = git@github.com:personal/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
# Use the personal SSH key for this remote
sshCommand = ssh -i ~/.ssh/personal_rsa
[remote “work”]
url = git@github.com:work/project.git
fetch = +refs/heads/*:refs/remotes/work/*
# Use the work SSH key for this remote
sshCommand = ssh -i ~/.ssh/work_rsa
This will specify which SSH key to be used for each remote URL. Restart your Git client APP so it reloads the git configuration for the project.
git cherry-pick is a powerful command that enables arbitrary Git commits to be picked by reference and appended to the current working HEAD.
Cherry picking is the act of picking a commit from a branch and applying it to another.
This is a useful tool but not always a best practice. Cherry picking can cause duplicate commits and in many scenarios where cherry picking would work, traditional merges are preferred instead.
In PHPStorm use the option from the menu Git > “Show diff with working tree” where you compare 2 branches and can move code to your current branch from the branch you compare with.
Examples of how to use cherry pick.
You need to make sure you are on the correct branch and then use cherry pick option from the APP or by the terminal. The commit you cherry picked will be applied to your current branch.
By terminal:
git cherry-pick
You can easily find the SHA for a commit using a visual APP instead of the terminal.
It can be displayed by selecting a commit or right-click on a commit and find the option “Copy branch SHA”
You can add to cherry pick the parameter -e or –edit to edit the commit message before actual commit.
Free: SourceTree (MacOS, Windows)
Free: GitFiend ( MacOS, WIndows, Linux ) – has less options than SourceTree
Premium: GitKraken ( MacOS, Windows, Linux )
Or you can use your code editor.
PHPStorm – has built in Git client system.
Visual Studio Code – Install plugin GitLens
Do you like this article? Share it and send us your feedback! Check out our articles page, where you might find other interesting posts. Also, if you want to learn more about business, check out the WPRiders Blog!