I’ve been using my standard Github account for all repos, but recently a client required us to use a new username for security reasons. Now I can’t clone the new repo because SM has been configured to use my personal account. I’ve been scouring all menu panels for a “switch user” option, but I cannot find it. I’ve seen some realy complicated script options in this forum, like this one but it looks too advanced for my case. I’m looking for a simple “switch user” option like with Sourcetree, Github desktop, or GitKraken without requiring SSH keys. How can I easily switch the user in Sublime Merge?
Thanks for sharing your feedback with the Sublime Merge team.
Could you confirm which platform you are on?
I’m using Windows10.
While we don’t have a dedicated “Switch User” feature, there should be a way to achieve your goals depending on which method of authentication you are using.
Assuming you’re using HTTPS authentication (not SSH), you can edit the git
config file of the repository failing to authenticate.
For example, say your GitHub repository is called
my_repository, follow the below steps:
- Navigate to the local
my_repositoryrepository in explorer
- Locate the
.gitfolder within the repository
- Open the
configfile located in this folder in your favorite text editor
- Locate the
remotesection of the repository (likely
- Under the remote section, locate the repository url of the format
- Replace this with
new_usernameis the new GitHub username you are required to authenticate with)
- Save the file
After all these steps have been completed, the next time perform a pull / push you should see an authentication dialog appear where you can enter the new authentication information.
If you ever want to switch back to the previous account, you can repeat the above, switching steps 5 and 6.
Let me know if this works.
Thanks Dylan! But how can I have a local
my_repository folder with a
.git folder if I can’t perform that initial clone repo command?
Thanks for your response - could you try replacing the clone URL with the format indicated in step 6 above.
If this does not work, I can investigate further.
Right, I see what you’re saying, but I can’t make it to step 2. There is no
.git folder because I can’t even clone the repo. The only account that can clone it is the new username, but my git settings are still configured to use the old username, so it won’t even let me perform the initial clone when I hit the green “Clone” button. So the
.git folder and config file does not exist yet.
Don’t worry about the previous steps - try the following:
Open Sublime Merge and navigate to the clone page
In the section labeled Source URL, paste the URL as shown in the above screenshot you shared.
https://in the Source URL, add
new_usernameis your new GitHub username.
For example, say your new GitHub username is
marquizzo_new, you would update the url from
Click the clone button
Once you’ve performed these steps, an authentication dialog should appear prompting you to log in with your new GitHub credentials.
Excellent, thank you! That worked.
Great to hear!
It’s worth noting that every time you clone a new repository that requires the new account, you’ll have to perform the above steps (as you’re overriding the default authentication information for GitHub that Windows has cached).
If you’d like to change the default account used to authenticate with GitHub, you’d need to clear the cached credential information.
To clear the cached credential information, you would:
- Open Windows Credential Manager (Search for
Credential Managervia the start menu)
- Delete the credential entry associated with https://github.com
Then the next time you go to clone a generic github URL (without the
username@ portion), you will be prompted to provide updated authentication credentials.
I fail to see how using a different user name is more secure. Or what reasons there could be to warrant this.
Yes, but but that’s irrelevant. The reasons behind it is not the point of my question.
Ah that is where you are making a mistake. Usually this kind of ‘solution’ is based on voodoo thinking.