Git push远程推送失败解决方式

在Git push的前提是已经clone了一个项目下来。

也就意味着有这个Git仓库,而且已经有了对应的用户。

假设:

我们的Git仓库名:test.git

我们的Git用户名:user

这个错误的报错如下:

git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags --set-upstream origin refs/heads/main:refs/heads/main 
Pushing to 123.123.123.123:/home/git/repo/test.git
kex_exchange_identification: read: Connection reset by peer
Connection reset by 123.123.123.123 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Completed with errors, see above

我们需要在服务器执行:

chown user test.git/
cd test.git/
chown user * -R

这样就可以成功push了

你可能感兴趣的:(git,服务器,git,push,权限)