Colors
To add coloration:
git config --global color.ui true
SSH
Connect to a remote repository without using the password (ssh key). On Bitbucket, different connection protocols have different repository URL formats. Create a private and public ssh key pair with for example the seahorse key manager. Then add the public key to bitbucket under manage account / security / SSH keys.Moving from https to ssh url format
My previous connection was through https. You can skip this command if you start with a fresh repository. Rename the remote "origin" to "originhttps".git remote rename origin originhttpsJust wanted to be able to connect through https in case the ssh connection doesn't work. This remote tracking branch can be deleted later with:
git remote remove originhttps
Tell git to use a ssh:// remote
Then tell git to use a remote (the "ssh://" protocol name is optional as shown in this how-to):git add remote origin ssh://git@bitbucket.org/accountname/reponame.gitFetch the new remote tracking branch into the local repository. (It will probably not load anything new but is required to set this branch as upstream later):
git fetch origin master
Set upstream branch
The commands "Git pull" and "git push" still connected to the https url (which prompts for a password). I had to set the new remote as the default for my master branch:git branch --set-upstream-to=origin/masterList remote branches (for information)
The repository is now ready to fetch, merge and pull on remote origin without entering the password.git branch -r
See also my post on git commands.
No comments:
Post a Comment