How to use default git clone statement instead of personal access token?

279 Views Asked by At

I want to use two git hub accounts for my personal and project works .i did my coding and pushed it through Ubuntu 18.04 terminal with my new Git ID credentials but in my new account it was showing commits as the contribution of my another account . so why Git using my other account name even though I pushed it through my new account Email/password ? I found this article which explaining steps for setting multiple accounts . as I am new to git and what I know that you can clone a project through following git command at your machine :

git clone https://github.com/USERNAME/PROJECTNAME

In the article it was said "Follow the steps below to clone the repository, create your first commit and push to GitHub:"

$ git clone [email protected]:USERNAME/test-ssh.git 
$ cd test-ssh
$ touch index.html
$ echo "Hello World" >> index.html
$ git add .
$ git commit -m 'Add index file'
$ git push origin master

I am not getting this different clone instruction , searched over internet and if I am not wrong it seems creating a personal access token ,is it ? So my question is can't we use the default way of cloning a project rather this way ?? and if I use the way recommend in the article then what it should be , should it be the following :

$ git clone [email protected]:MY-USERNAME/test-ssh.git

thank you !

1

There are 1 best solutions below

2
On

Commit message includes your mail address and emai from configuration not from your authorised account.

Your probably set it while back with following commands:

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

In your personal/work projects you can configure specific local repository with

$ git config user.name "John Doe"
$ git config user.email [email protected]