1. 程式人生 > 其它 >centos下git報錯Failed to connect to repository : Command "git ls-remote -h HEAD" returned status code 128:

centos下git報錯Failed to connect to repository : Command "git ls-remote -h HEAD" returned status code 128:

Failed to connect to repository : Command "git ls-remote -h HEAD" returned status code 128:
stdout:
stderr: fatal: repository 'http://ytgit.chinasoft.cn/chinasoft/innerapi.git/' not found


# 通過在git 伺服器上進行clone專案報錯如下
# git clone http://ytgit.chinasoft.cn/chinasoft/innerapi.git
Cloning into 'innerapi'...
fatal: repository 'http://ytgit.chinasoft.cn/chinasoft/innerapi.git/' not found

# git clone [email protected]:chinasoft/innerapi.git
Cloning into 'innerapi'...
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


經過搜尋發現是本地git配置和倉庫裡的 .git/config 不一致


# 遠端倉庫配置
# more maxserver/.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = http://ytgit.chinasoft.cn/chinasoft/maxserver.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

本地配置:
# git config --list
user.password=chinasoft1234
[email protected]
credential.helper=store


# 修改本地配置後問題解決
[root@sz_yt_jenkins01_12_99 ~]# cat .gitconfig
[user]
#password = chinasoft1234
#email = [email protected]
[credential]
helper = store
[root@sz_yt_jenkins01_12_99 ~]# cat .git-credentials
http://yt_release_deployment:[email protected]
#http://chengjn:[email protected]
#http://chengjn:[email protected]