Error: Permission denied (publickey) This terribly nondescript error simply means that the server rejected your connection; the most common reasons are explained below. Sudo or sudon't? You should not be using the sudo command with Git. Check that you are connecting to the correct server Typing is hard, we all know it. To make sure you are connecting to the right domain, you can enter the following command: ssh -vT git@github.com# OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011# debug1: Reading configuration data /Users/you/.ssh/config# debug1: Reading configuration data /etc/ssh_config# debug1: Applying options for *# debug1: Connecting to github.com [192.30.252.131] port 22. Note the IP address (the numbers within the [ ] brackets). Always use the "git" user All connections must be made as the "git" user. ssh -T billy.anyteen@github.com# Permission denied (publickey). Instead, you should verify your connection by typing: ssh -T git@github.com# Hi username! Make sure you have a key that is being used Getting more details
Aha! Moments When Learning Git Git is a fast, flexible but challenging distributed version control system. Before jumping in: Along with a book, tutorial and cheatsheet, here are the insights that helped git click. There's a staging area! Git has a staging area. Yowza, did this ever confuse me. git add foo.txtAdd foo.txt to the index. Why stage? But now there's two undos: git checkout foo.txtUndo local changes (like svn revert)git reset HEAD foo.txtRemove from staging area (local copy still modified). Add and commit, add and commit -- Git has a rhythm. Branching is "Save as..." Branches are like "Save as..." on a directory. Easily merge changes with the original (changes tracked and never applied twice)No wasted space (common files only stored once) Why branch? Imagine virtual directories I see branches as "virtual directories" in the .git folder. My inner dialogue is "change to dev directory (checkout)... make changes... save changes (add/commit)... change to master directory... copy in changes from dev (merge)". Local data
Generating SSH Keys SSH keys are a way to identify trusted computers, without involving passwords. The steps below will walk you through generating an SSH key and adding the public key to your GitHub account. We recommend that you regularly review your SSH keys list and revoke any that haven't been used in a while. Tip: GitHub has a desktop client! Tip: If you have GitHub for Windows installed, you can use it to clone repositories and not deal with SSH keys. Step 1: Check for SSH keys First, we need to check for existing SSH keys on your computer. ls -al ~/.ssh# Lists the files in your .ssh directory, if they exist Check the directory listing to see if you already have a public SSH key. id_dsa.pubid_ecdsa.pubid_ed25519.pubid_rsa.pub If you see an existing public and private key pair listed (for example id_rsa.pub and id_rsa) that you would like to use to connect to GitHub, you can skip Step 2 and go straight to Step 3. Tip: If you receive an error that ~/.ssh doesn't exist, don't worry!
Understanding Git Conceptually Introduction This is a tutorial on the Git version control system. Git is quickly becoming one of the most popular version control systems in use. A Story When I first started using Git, I read plenty of tutorials, as well as the user manual. After a few months, I started to understand those under-the-hood concepts. Understanding Git The conclusion I draw from this is that you can only really use Git if you understand how Git works. Half of the existing resources on Git, unfortunately, take just that approach: they walk you through which commands to run when, and expect that you should do fine if you just mimic those commands. This tutorial, then, will take a conceptual approach to Git. Go on to the next page: Repositories
Deploying with Git Last updated 12 October 2015 Git is a powerful decentralized revision control system, and is the means for deploying apps to Heroku. You don’t need to be proficient with Git to use it for deploying code to Heroku, but you may find it valuable to learn the basics. Tracking your app in git Heroku apps expect the app directory structure at the root of the repository. Before you can push an app to Heroku, you’ll need to initialize a local Git repository and commit your files to it. $ cd myapp $ git init Initialized empty Git repository in .git/ $ git add . $ git commit -m "my first commit" Created initial commit 5df2d09: my first commit 44 files changed, 8393 insertions(+), 0 deletions(-) create mode 100644 README create mode 100644 Procfile create mode 100644 app/controllers/source_file ... This is a local repository, now residing inside the .git directory. Creating a Heroku remote Git remotes are references to remote repositories. By default, Heroku configures HTTP as the Git transport. !
Préface Git est un couteau suisse de la gestion de versions. Un outil de gestion de révisions multi-usage, pratique et fiable, dont la flexibilité en rend l’apprentissage pas si simple, sans parler de le maîtriser ! Comme Arthur C. Clarke le fait observer, toute technologie suffisamment avancée se confond avec la magie. Plutôt que de rentrer dans le détails, nous donnons des instructions pour obtenir tel ou tel effet. Je reste modeste devant le travail fourni par tant de monde pour traduire ces pages. Dustin Sallings, Alberto Bertogli, James Cameron, Douglas Livingstone, Michael Budde, Richard Albury, Tarmigan, Derek Mahar, Frode Aannevik, Keith Rarick, Andy Somerville, Ralf Recker, Øyvind A. François Marier maintient le paquet Debian, créé à l’origine par Daniel Baumarr. Ma gratitude va également à beaucoup d’autres pour leurs encouragements et compliments. Si par erreur je vous ai oublié, merci de me le signaler ou, plus simplement, envoyez-moi un patch ! Hébergement Git gratuit
Installing Git There are a lot of different ways to use Git. There are the original command line tools, and there are many graphical user interfaces of varying capabilities. For this book, we will be using Git on the command line. For one, the command line is the only place you can run all Git commands – most of the GUIs only implement some subset of Git functionality for simplicity. If you know how to run the command line version, you can probably also figure out how to run the GUI version, while the opposite is not necessarily true. Also, while your choice of graphical client is a matter of personal taste, all users will have the command-line tools installed and available. So we will expect you to know how to open Terminal in Mac or Command Prompt or Powershell in Windows.
Using Git to manage a web site The HTML source for my (i.e., this) web site lives in a Git repository on my local workstation. This page describes how I set things up so that I can make changes live by running just "git push web". The one-line summary: push into a remote repository that has a detached work tree, and a post-receive hook that runs "git checkout -f". The local repository It doesn't really matter how the local repository is set up, but for the sake of argument, let's suppose you're starting one from scratch. $ mkdir website && cd website $ git init Initialized empty Git repository in /home/ams/website/.git/ $ echo 'Hello, world!' Anyway, however you got there, you have a repository whose contents you want to turn into a web site. The remote repository I assume that the web site will live on a server to which you have ssh access, and that things are set up so that you can ssh to it without having to type a password (i.e., that your public key is in ~/.ssh/authorized_keys and you are running ssh-agent locally).