Git Pull:更改身份验证 [英] Git Pull: Change Authentication

查看:104
本文介绍了Git Pull:更改身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对git很陌生。我有一个服务器上的repo安装(A),通过ssh rsa密钥进行访问。我有几个用户,包括我自己。现在我在本地机器上执行 git clone 并获取本地副本,进行更改,并且 push origin master ,所有内容



我遇到的问题是我们的测试服务器(服务器B)已经安装了一切,我想要做的就是拉我的最新更改到该服务器。测试服务器还拥有多个用户,以及 www-data 作为整个目录(运行Apache)的所有者。



使用我的名字通过SSH登录时,我不能 git pull ,说.git被锁定,所以我做了 sudo git pull 向我询问不同用户(user1)的密码。我不知道密码,我想彻底删除该用户,但在此之前,我必须在测试服务器上切换git repo,以便使用MY身份验证(kovshenin)而不是user1来更改。



要做到这一点的正确方法是什么?我不想删除所有内容,并从新克隆开始,因为它有一些本地更改。

在三小时后寻找和玩我自己找到了答案。身份验证详细信息存储在 .git / config 文件中 url 设置下的 [远程起源] 部分。


I'm quite new to git. I have a repo setup on a server (A) where access is via ssh rsa keys. I have a few users there including myself. Now I do git clone on my local machine and get a local copy, make changes, and push origin master, everything works fine.

The problem I'm experiencing is that our testing server (server B) already has everything setup and what I'd like to do is pull my latest changes to that server. The testing server has also got several users, as well as www-data as the owner of the whole directory (running Apache).

When logging in via SSH using my name, I cannot git pull, says .git is locked, so I do sudo git pull which asks me the password for a different user (user1). I do not know that password and I'd like to remove that user completely, but before I do, I have to switch the git repo on the testing server to pull changes using MY authentication (kovshenin) and not user1's.

What's the correct way to do that? I wouldn't like to remove everything and start from a fresh clone, since it has some local changes.

解决方案

After three hours of searching and playing I have found the answer myself. The authentication details are stored in the .git/config file under the url setting in the [remote "origin"] section.

这篇关于Git Pull:更改身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆