0

I use a corporate machine and I want to make my own repo (or contribute to a repo) in GitLab. But every time when I try to create a branch, it is created with my corporate ID and corporate email. How can I use my own Gmail ID to do the same ?

I am ok for using Http as well rather than setting extra ssh key. But it will be helpful to have both ssh keys for corporate and personal usage and track it down accordingly.

Soumya Kanti Naskar
  • 1,021
  • 3
  • 16
  • 29

1 Answers1

1

If you refer to the author/email associated to the commits you are creating, then this has nothing to do with HTTPS or SSH keys.

Set your username and email in your local repository:

cd /path/to/repo
git config user.name <perso name>
git config user.email <GMail ID>

Then make changes, commit and push.

For pushing with your GitLab credentials, then you use two different keys, as described in "How to work on personal GitHub repo from office computer whose SSH key is already added to a work related GitHub account?"

The same applies to GitLab:

#Personal GitLab
Host persgl
  HostName gitlab.com
  User git
  IdentityFile ~/.ssh/id_rsa_perso

#Personal Work
Host workgl
  HostName gitlab.com
  User git
  IdentityFile ~/.ssh/id_rsa_work

In that case, change your remote URL:

cd /path/to/perso/repo
git remote set-url persgl:<me>/<myProject>
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250