Multiple Users in GitHub for Multiple Projects

Somar Kesen
2 min readDec 23, 2021

--

Photo by Yancy Min on Unsplash

If you are a beginner or new to using Git. This article is for you !
Many times you need to use another Git Account on the same computer for multi projects, So it is unreasonable to keep switching between them.

First, you need to set a specific account for every single project you will create. For example, let’s say we create a new project called “Our_New_Project” and we want to connect it with Git account “somarkn99”. To do this we will follow the following steps:

1- Create and connect to the Repository:

After you create repo in your Git account, open your project in your IDE “VS Code it’s my favorite” and in terminal write this command:

git init

This command creates an empty Git repository basically a git directory with subdirectories for objects, refs/heads, refs/tags, and template files. An initial branch without any commits will be created (you can know more about this command from here), then:

git remote add origin https://github.com/YOUR_USER_NAME/YOUR_Git_REPO_NAME.git

You can get this link from your repo page like this photo 👇🏻

Now you tell your IDE that you want to connect this project to that repository on Git.

2- Set our config setting:

After we link the repository now, we should Identification of our user who will be working on it.

Now in your terminal write these commands:

git config credential.${remote}.username YOUR_USER_NAME

git config credential.helper store

git config user.name YOUR_USER_NAME

git config user.email YOUR_EMAIL

What we just did is defining the user specifically for this repository in order to work on it. Now try to create some files and push it in traditional commands:

git add .

git commit -m “YOUR_COMMIT_MESSAGE”

git push -u origin master

You will be asked for user password enter it and BOOOM you did it💥

There are many important and useful commands for you in your work within Git, you can learn about them through their website here, or see some tutorials. There are many on the Internet and my favorites is freecodecamp.

Hope this was useful and insightful to you.

--

--

Somar Kesen

Entrepreneur | Web Developer | Active in the children’s programming community www.somar-kesen.com