How can I configure Pkg to use specific git

After I upgrade to MacOS Monterey, my Homebrew installed git does not work. I have uninstalled that git. Now I can use the Xcode git (/usr/bin/git) in the terminal. But when I add/update a github repo, I get the following error

(test) pkg> add "git@github.com:liuyxpp/PolymerArchitecture.jl.git#main"
     Cloning git-repo `git@github.com:liuyxpp/PolymerArchitecture.jl.git#main`
dyld[32048]: missing symbol called

signal (6): Abort trap: 6
in expression starting at none:0

The error message is the same as those emitted by my previous Homebrew installed git.

Edit:

Anyone know how to find out which symbol in which lib I am missing?

Edit 2:

The issue is finally solved. I have exported some paths for DYLD_LIBRARY_PATH and LD_LIBRARY_PATH in my .bash_profile long time ago which may provide an inconsistent version of some linked library for git. I find this out by trying to compile git from source. And indeed the linking stage of the compilation failed due to a link error related to libiconv, which points me to check my LD flags and settings.

Probably same reason as https://github.com/JuliaLang/Downloads.jl/issues/149

FYI, a new 1.6 release is in the pipeline which should fix this. If you can, please try out the release-1.6 branch on the Julia repo and see if this fixes it for you.

I have tried Julia 1.7.0, the issue still preserves. I can add registered packages, though. However, I cannot add unregistered packages, and cannot registry add a private registry hosted as a private github repo.

The issue is finally solved. I have exported some paths for DYLD_LIBRARY_PATH and LD_LIBRARY_PATH in my .bash_profile long time ago which may provide an inconsistent version of some linked library for git. I find this out by trying to compile git from source. And indeed the linking stage of the compilation failed due to a link error related to libiconv , which points me to check my LD flags and settings.