Troubleshooting¶
Overview¶
When working with Git, you may encounter various problems. To minimize the time spent on troubleshooting, it is essential to have a solid understanding of Git concepts and tools.
Problems¶
[RESOLVED] Broken branch remote on the local tree¶
Description: When pull branch on the local machine, you will see this error below
git pull origin master
# fatal: bad object refs/remotes/origin/<branch-name>
# error: https://github.com/<organization>/<project>.git did not send all necessary objects
Troubleshooting: The objects on the path refs/remotes/origin/<branch-name> not exist
Solved by:
- Remove the head of the target branch that not send any necessary objects of git
- Fetch with prune for the project
This will fetch all current branch that not exist in the local repository.
You will see something like this below
$ git fetch --prune
# From https://github.com/<orgranization>/<project>
# xxxxxxx..xxxxxxx master -> origin/master
# * [new branch] <branch-deployment-example> -> origin/<branch-deployment-example>
# * [new branch] <feature-example> -> origin/<feature-example>
# xxxxxxx..xxxxxxx production -> origin/production
- Normal run as example
$ git pull origin master
From https://github.com/<orgranization>/<project>
* branch master -> FETCH_HEAD
Already up to date.
Reference:
[RESOLVED] Could not resolve host: github.com¶
Describle: When you pull some branch (example: master). The error has been captured Could not resolve host
git pull origin master
# fatal: unable to access 'https://github.com/[ORGANIZATION]/[PROJECT].git/': Could not resolve host: github.com
Come from:
- You has available tunnel proxy to the host that make the target can't not resolve
Solved by:
-
Turn off some VPN construction (like) OpenVPN
-
Turn off 3rd-party like Proxy
You can use the git+ssh URI scheme, but you must set a username. Notice the git@ part in the URI:
Also read about deploy keys.
PS: In my installation, the "git+ssh" URI scheme works only with "editable" requirements:
[WORKAROUND] git getaddrinfo() thread failed to start¶
Description: When any event of fetch, push, pull hit git getaddrinfo() thread failed to start
git pull
git fetch
# fatal: unable to access 'https://github.com/[REPOSITORY]/[NAME]/': getaddrinfo() thread failed to start
Workaround 1: Restart network
Workaround 2: Restart computer (This will reset the network)
Note: Until now, only restarting the computer (option 2) has been shown to work. Other solutions may not be effective.