Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Pull: Change Authentication

Tags:

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.

like image 970
kovshenin Avatar asked Oct 28 '10 08:10

kovshenin


1 Answers

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.

like image 105
kovshenin Avatar answered Oct 13 '22 20:10

kovshenin