Git Pull: Change Authentication

Hey all, this is quick one, since 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).

  • Configuring Subversion to use system users/passwords
  • git-http-backend and ldap authentication, push error: requested URL returned error: 401 Authorization Required
  • Using a git repository as a website root folder
  • Git, Debian, Apache and Smart HTTP
  • Jenkins behind Apache Server / Can't log in Jenkins
  • Error “The server sent an improper HTTP response.” on commit with Subversion 1.8+ client
  • 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.

    Thanks in advance for all your help.

  • Default number of commits for Git log
  • Pull new updates from original GitHub repository into forked GitHub repository
  • Deploy a git tag to Amazon Elastic Beanstalk
  • git does not show up a newly created branch Gerrit Code Review UI
  • How to configure git to include my name in commits
  • Copying a git repository to USB drive
  • One Solution collect form web for “Git Pull: Change Authentication”

    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. Thanks.

    Git Baby is a git and github fan, let's start git clone.