Remember Username and Password with Bonobo Git Server
Lots of Bonobo Git Server users want to store the user name and the password with the git client of their choice. It is much more comfortable to not having to enter the user name for each simple push and pull. I would be much more careful with the password because, as you’ll see later, it is stored as an unencrypted value and can be retrieved at any time.
The new version released a week ago allows you to store both the user name and the password. Let’s take a look how you can do it.
Bonobo Git Server works over HTTP or HTTPS protocol. Git clients use the basic authentication to push and pull changesets and repositories. This type of authentication allows you to store username and password as a part of the URL you are connecting to.
Let’s create a repository in Bonobo Git Server.
Now open the git client - msysgit for me. Run the following command for cloning the repository. Change the user name and password to proper values or to the empty one if you don’t want to save it.
git clone http://username:email@example.com/bonobo-git-repository.git
If you use GUI git client just enter the URL above as a repository URL.
You can experiment with the URL and enter just a user name and leave the password empty. Following command illustrates how to store only username.
git clone http://username:@myserver.com/bonobo-git-repository.git
If you’ve cloned your repository already you can change the URL of the remote. Your remote would probably be called origin but if you are not sure you can list them with the command
git remote -v.
When you have the name of the remote just run the following command. In this case the remote is called origin and the URL is the same as from the previous example.
git remote set-url origin http://username:@myserver.com/bonobo-git-repository.git/
From changing the existing remote URL you can see that saving the password isn’t such a good idea. It can be displayed with git client at any time and it isn’t protected in any way. So it is better to store just a user name and for each commit provide only the password.
With the new version of the Bonobo Git Server you don’t have to remember your credentials. You can store them as a part of the URL you are connecting to.
This approach can be used with many git servers that support basic authentication and the communication via HTTP protocol - including github.