1

I recently signed up with github to gitlab account.I was pushing the projects earlier with some other user's credentials but now I want to use my own github account. I changed the user name and email with

 git config --global user.name <myusername>
 git config --global user.email <myemail>

Well I can push as myusername now but the activities i do don't reflect in my profile.Infact they are reflected in the previous user account mentioning Authored by <myname> while contributions are shown under his name. When I open my account my contributions are none.

I checked out on the other posts about removing windows credentials but my device hasn't stored any git credentials.I am not able to get what is the problem and how to solve this.

nikita mullick
  • 97
  • 2
  • 11
  • 3
    The two configuration entries you called out (`user.name` and `user.email`) are not credentials. They are arbitrary strings that Git inserts into commit metadata. Credentials are used when your Git calls up another Git: if you use an `https://...` URL your Git tells the other system's web server about you (user name and password); if you use an `ssh://...` URL your Git invokes your ssh, and your ssh provides an RSA or similar key, quite independent of Git. – torek Mar 03 '18 at 16:44
  • Hence, when talking with either GitHub or GitLab, the first question to answer is: are you using http, or ssh? The answer to that guides you to where to look for the credentials being passed. (The OS you use factors in as well but you have already mentioned Windows, so at least we know that part.) – torek Mar 03 '18 at 16:45
  • I am using http – nikita mullick Mar 03 '18 at 16:47
  • OK - this is not exactly the same question but might have the right answer: https://stackoverflow.com/q/15381198/1256452 – torek Mar 03 '18 at 18:54

1 Answers1

2

First, set your remote URL with the right user account in it:

cd /path/to/my/local/repo
git remote set-url origin https://myGitLabAccount@gitlab.com/myGitLabAccount/myrepo.git

Second, check your git credential helper:

git config credential.helper

If set, that helper should prompt you for your GitHub password, and cache it.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • correct me if i am wrong ,I think i should be using gitlab account for this because i want to setup for gitlab.Right? – nikita mullick Mar 04 '18 at 08:27
  • @nikitamullick If you are pushing to GitLab, then yes, use your GitLab account username. – VonC Mar 04 '18 at 08:30
  • @nikitamullick actually, the credential helper will be able to cache the credentials associated to @gitlab.com, even if the username is the same as the GitHub one. Just make sure you do have a credential helper defined. – VonC Mar 04 '18 at 08:37