Gituser CLI – Switch between git accounts easily

Hello there ?

First of all you all may be wondering “What in the world is gituser??”

Gituser is a command line interface made with Golang that helps to switch between different git user accounts.

I have built this cli because I was using my laptop f…


This content originally appeared on DEV Community and was authored by Lucas Neves Pereira

Hello there ?

First of all you all may be wondering "What in the world is gituser??"

Gituser is a command line interface made with Golang that helps to switch between different git user accounts.

I have built this cli because I was using my laptop for my personal projects, my school projects and my work related projects. Meaning I had multiple git user accounts in my machine.

Every time I had to type the following command:

git config --global user.name "myUserName"
git config --global user.email "myEmail"

This may not be the need of a lot of developers but I've decided to put this program as open source in case other developers need it. You can find the project here as well as the contribution guide I have wrote.

Being a newbie to golang and open source projects I think that this program as a lot of room for improvement.

Usage

Gituser can be use globally in your machine, that's the point of cli tools I guess ? , therefore there is a few steps that you need to make like exporting variables on your PATH, I have also wrote a guide about how to proceed on MacOS. You can find it here. I know that this can be improved but I just don't have enough experience about building "installers".

Once you have the tool on your machine you can test it out by running gituser on a terminal.

demo

This will print you a manual.

Modes

There are currently 3 modes available in the program:

  • ? work : for a work related git account.
  • ? school : for a school related git account.
  • ? personal : for a personal related git account.

You can run gituser -now to see what mode you are using.

To switch from a mode to another you just have to run gituser <mode>.

Examples:

gituser work
gituser school
gituser personal

Data configuration

The modes are cool but we need to actually add our multiple git accounts data to our program.

To do so you just have to run:

gituser config

This will prompt you to a select where you can choose what mode account you want to configure.

Screenshot 2021-04-16 at 20.42.19

After choosing your mode you just have to enter your username and email of the related git account.

Screenshot 2021-04-16 at 20.43.49

This will then write your data to a local data.jsonfile that you normally exported to your PATH if you followed the installation guide ??

Conclusion

That's basically what I have for now! You can use gituser and test it out.

Hope this helps developers that have the same need as I. Feel free to leave some remarks, I know there is a quite of them. Once again I am very new to this world ?.

Find the project here.

See you soon! ??


This content originally appeared on DEV Community and was authored by Lucas Neves Pereira


Print Share Comment Cite Upload Translate Updates
APA

Lucas Neves Pereira | Sciencx (2021-04-16T18:51:37+00:00) Gituser CLI – Switch between git accounts easily. Retrieved from https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/

MLA
" » Gituser CLI – Switch between git accounts easily." Lucas Neves Pereira | Sciencx - Friday April 16, 2021, https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/
HARVARD
Lucas Neves Pereira | Sciencx Friday April 16, 2021 » Gituser CLI – Switch between git accounts easily., viewed ,<https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/>
VANCOUVER
Lucas Neves Pereira | Sciencx - » Gituser CLI – Switch between git accounts easily. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/
CHICAGO
" » Gituser CLI – Switch between git accounts easily." Lucas Neves Pereira | Sciencx - Accessed . https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/
IEEE
" » Gituser CLI – Switch between git accounts easily." Lucas Neves Pereira | Sciencx [Online]. Available: https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/. [Accessed: ]
rf:citation
» Gituser CLI – Switch between git accounts easily | Lucas Neves Pereira | Sciencx | https://www.scien.cx/2021/04/16/gituser-cli-switch-between-git-accounts-easily/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.