git - ovigia/distrosnetinstall GitHub Wiki

git

links, aplicações (cli e gui) e dicas para usar o git

Tech Talk: Linus Torvalds on git

índice

links

  1. Git

  2. Git Tutorial - Try Git

  3. Git - Book

  4. Learn Git Branching

  5. git-cheat-sheet-education - git-cheat-sheet-education.pdf

  6. Git cheat sheet | Atlassian Git Tutorial

  7. Git cheat sheet zeroturnaround.com

  8. Git - Reference

  9. Git Cheat Sheet for Beginners

  10. What is the best Git cheat sheet? - Quora

  11. Uma Referência Visual de Git

  12. Home // Think Like (a) Git

  13. git ready » learn git one commit at a time

  14. Git Magic - Preface

  15. tbaggery - A Note About Git Commit Messages

  16. $ command line ruby cheat sheets

  17. git-fu | Where programmers learn from the masters

  18. Seth Robertson Project information

  19. Git Immersion - Brought to you by Neo

  20. [EDIT] How to Move a Private Repository from Bitbucket to Github

  21. Moving from GitHub to Bitbucket - Why and How - Top Draw

  22. Transfer repo from Bitbucket to Github

  23. 6 places to host your git repository | Opensource.com

  24. Learn Enough Git to Be Dangerous | Learn Enough to Be Dangerous

  25. How to store dotfiles | Atlassian Git Tutorial

  26. How to Write a Git Commit Message

apps

  1. Git - Downloads
  2. Git - git-gui Documentation
  3. Introduction · Tig - Text-mode interface for Git

cloud

  1. https://bitbucket.org/
  2. https://github.com/

dicas

Step 1. Set up your default identity

  1. From the terminal, enter ssh-keygen at the command line. The command prompts you for a file to save the key in:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa):
  1. Press the Enter or Return key to accept the default location.
To create a key with a name or path other than the default, specify the full path to the key. For example, to create a key called my-new-ssh-key, enter a path like the one shown at the prompt:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa): /Users/emmap1/.ssh/my-new-ssh-key
  1. Enter and re-enter a passphrase when prompted. The command creates your default identity with its public and private keys. The whole interaction will look similar to the following:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa):
Created directory '/Users/emmap1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/emmap1/.ssh/id_rsa.
Your public key has been saved in /Users/emmap1/.ssh/id_rsa.pub.
The key fingerprint is:
4c:80:61:2c:00:3f:9d:dc:08:41:2e:c0:cf:b9:17:69 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|*o+ooo.          |
|.+.=o+ .         |
|. *.* o .        |
| . = E o         |
|    o . S        |
|   . .           |
|     .           |
|                 |
|                 |
+-----------------+
  1. List the contents of ~/.ssh to view the key files.
$ ls ~/.ssh
id_rsa id_rsa.pub

Step 2. Add the key to the ssh-agent

  1. If you don't want to type your password each time you use the key, you'll need to add it to the ssh-agent.
To start the agent, run the following:
$ eval `ssh-agent`
Agent pid 9700
  1. Enter ssh-add followed by the path to the private key file:
$ ssh-add ~/.ssh/<private_key_file>

Step 3. Add the public key to your Bitbucket settings

From Bitbucket, choose Bitbucket settings from your avatar in the lower left.

The Account settings page opens. Click SSH keys. If you've already added keys, you'll see them on this page. In your terminal window, copy the contents of your public key file.

On Linux, you can cat the contents:

$ cat ~/.ssh/id_rsa.pub

Select and copy the key output in the clipboard. If you have problems with copy and paste, you can open the file directly with Notepad. Select the contents of the file (just avoid selecting the end-of-file characters).

From Bitbucket, click Add key.

Enter a Label for your new key, for example, Default public key. Paste the copied public key into the SSH Key field. You may see an email address on the last line when you paste. It doesn't matter whether or not you include the email address in the Key.

Click Save. Bitbucket sends you an email to confirm the addition of the key.

Return to the terminal window and verify your configuration and username by entering the following command:

ssh -T [email protected]

The command message tells you which of your Bitbucket accounts can log in with that key.

conq: logged in as emmap1.
You can use git or hg to connect to Bitbucket. Shell access is disabled.

Now that you've got an SSH key set up, use the SSH URL the next time you clone a repository. If you already have a repository that you cloned over HTTPS, change the remote URL for your repository to use its SSH URL.

To change the remote URL for a repository, you'll need to update the configuration file with the new URL. Otherwise, you'll get an error when attempting to push your repository. If you don't want to edit the configuration file, you can also clone the repository from the new location. If you clone, be aware that you'll lose any changes you made but had not pushed to Bitbucket before the transfer.

The URL you use for a repository depends on which protocol you're using: HTTPS or SSH. You can find these URLs from the Clone button on the Source page of your repository.

You can click back and forth between the SSH and the HTTPS protocol links to see how the URLs differ. The table below shows how the formats vary based on protocol.

Update the URL for Git repositories

  1. From a terminal, navigate to the repository.
$ cd ~/<path_to_repo>
  1. Run git remote -v to see the current remote URL.
$ git remote -v
origin https://[email protected]/tutorials/tutorials.git.bitbucket.org.git (fetch)
origin https://[email protected]/tutorials/tutorials.git.bitbucket.org.git (push)
  1. Update the remote URL with git remote set-url using the current and new remote URLs.
$ git remote set-url origin [email protected]/tutorials.git.bitbucket.org.git

If you update your URL from HTTPS to SSH, next time you push or pull from your repository, the terminal responds that it is adding the Bitbucket host to the list of known hosts. You also won't have to enter a password.