Skip to content

Troubleshooting

Overview

When working with Git, there can various of problems you can meet. And with by the timeing, the troubleshooting of Git need to reduced less.

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

Resolved by:

  1. Remove the head of the target branch that not send any necessary objects of git
rm -rf .git/refs/remotes/origin/
  1. 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
  1. 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:

pip install git+ssh://git@github.com/echweb/echweb-utils.git

Also read about deploy keys.

PS: In my installation, the "git+ssh" URI scheme works only with "editable" requirements:

pip install -e URI#egg=EggName

Remember: Change the : character that git remote -v prints to a / character before using the remote's address in the pip command:

$ git remote -v
# origin git@github.com:echweb/echweb-utils.git (fetch)

^ change this to a '/' character

If you forget, you will get this error:

ssh: Could not resolve hostname github.com:echweb: nodename nor servname provided, or not known

https://stackoverflow.com/questions/4830856/is-it-possible-to-use-pip-to-install-a-package-from-a-private-github-repository