centos7本地git仓库操作时遇到的问题及解决方式列表

2023-06-01 00:00:00 操作 方式 仓库

问题1:

*** Please tell me who you are.
Run
  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address ([email protected].(none)')

解决方式:

git config --global user.email "[email protected]"
git config --global user.name "root"

问题2:

[[email protected] obj]# git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

解决方式:

检查项目根目录.git/config文件  分支主干 没有就补上去 直接把下面的复制也行

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = /home/git/demo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

保存好后 继续执行命令

[[email protected] obj]# git push origin master
Counting objects: 16251, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (15798/15798), done.
Writing objects: 100% (16251/16251), 27.94 MiB | 1.88 MiB/s, done.
Total 16251 (delta 8430), reused 0 (delta 0)
To /home/git/demo.git
 * [new branch]      master -> master

问题3:

[[email protected] ~]# git clone [email protected]:/home/git/demo.git
Cloning into 'demo'...
[email protected]'s password: 
Permission denied, please try again.
[email protected]'s password: 
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

解决方式:

创建仓库的时候可能没设置git用户密码

到git仓库服务器给git用户设置密码

passwd git用户 123456

问题4:

[[email protected] ~]# git clone [email protected]:/home/git/demo.git
fatal: destination path 'demo' already exists and is not an empty directory.

解决方式:

字面意思 目标路径‘demo’已经存在并且不是一个空目录

之前执行命令的时候拉了个有问题的文件夹过来

直接删除掉该文件夹 重新执行命令

[[email protected] ~]# git clone [email protected]:/home/git/demo.git
Cloning into 'demo'...
[email protected]'s password: 
remote: Counting objects: 16251, done.
remote: Compressing objects: 100% (7368/7368), done.
remote: Total 16251 (delta 8430), reused 16251 (delta 8430)
Receiving objects: 100% (16251/16251), 27.94 MiB | 10.36 MiB/s, done.
Resolving deltas: 100% (8430/8430), done.
Checking out files: 100% (33643/33643), done.

更新中

...

相关文章