Sometimes we face one common problem which is maintaining our multiple github account. I face this too.
We can do it in many ways. Some generate ssh key for their each account and so on. I am just sharing one way how we can use multiple git account for our multiple projects. Let's dive into it.
First of all we need to initialize the repository
git init
Second we need to add all files to that repo
git add .
Third we need to add our first commit
git commit -m "first commit"
We need a token which we can generate from our account Settings/Developer settings/Personal access tokens . I used Token (classic). you can also use Beta as well
Now we will get a token
Finally time to push
git push https://user-name:your-token@github.com/user-name/reponame.git
For example
git push https://saanchita-paul:token12345token@github.com/saanchita-paul/polymorphic.git
sometimes it may say to use
git push --set-upstream git push https://user-name:your-token@github.com/user-name/reponame.git
It's because git push --set-upstream is a command used to push your changes from a local Git repository to a remote Git repository and set the branch you're pushing to as the default upstream branch.
When you first create a branch in your local Git repository and want to push it to a remote repository, you need to specify the upstream branch using --set-upstream or -u option. This allows Git to know where to push the changes and which branch to track.
Happy Coding 🎉
Top comments (0)