Yocto build failed due to fetch error

while trying to build a yocto image I got several “Fetcher failure for URL:” errors and per each of the failures got this message:
“File “/local/users/HRT4_16/build/tmp/hosttools/git”, line 26, in
os.execv(real_git, sys.argv)
TypeError: execv: path should be string, bytes or os.PathLike, not NoneType”.

In my case these errors were related to a wrong yocto environment configuration.
In case you have already built yocto x to any platform and now trying to build one for a different platform, it is advisable to close the current terminal\tmux\etc, open a new one and set the yocto build env from scratch.