Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Git Cheat Sheet ====== ===== Merge Unrelated Histories ===== Usually happens when just create new repo in Bitbucket and auto create .gitignore. It will conflict with our local repo which hasn't been registered in any external repo. The error is resolved by toggling the allow-unrelated-histories switch. After a git pull or git merge command, run the following command: <code> git pull http://bitbucket.org/etcetc master --allow-unrelated-histories </code> ===== Resolving Conflict ===== Provided that you already setup the merge tool to your favorite software (Kdiff3 or others) : <code> git mergetool </code> ===== Using Git with SSH Connection ===== ==== Why use SSH ? ==== Compare to HTTPS, using SSH is more secure. You never send your username and password accros the network. For a private repository, SSH is much preferred. ==== Step by Step ==== 1. Create key pair for your account. Put your email as Comment (CLI option -C) on this key. If you use the same email for Bitbucket, Github, and Gitlab, you can use the same key for all of them. Using different key is more secure. If one key compromised, the other key is still secure. For refreshment about SSH, see [[:ssh|OpenSSH]] <code> ssh-keygen -t ed25519 -C "jim.merari@gmail.com" </code> 2. Go to your account setting menu in bitbucket.org/github.com/gitlab.com. Find the page related to SSH/GPG. The page will list all the keys that have been associated with your account. Copy the content of your newly generated public key to the corresponding setting form. See more detail on each respective website ([[https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/|Bitbucket]], [[https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh|Gitbub]]). After the new key listed, then you can push/fetch with the command : <code> git push ssh://git@github.com:jmerari/some-repo.git git push ssh://git@bitbucket.org:jmerari/some-repo.git </code> https://blog.developer.atlassian.com/different-ssh-keys-multiple-bitbucket-accounts/ git/start.txt Last modified: 2021/10/19 08:54by jmerari