工欲善其事, its prerequisite.
In OS X Yosemite 10.10.3, install the latest version of Xcode. You can see that git has been installed under terminal.
~ mesut$ git--versiongit version 2.3.2 (Apple Git-55)
has been registered and used GitHub, but has been managed remotely under the window System.
Now you start setting up Mac management GitHub, one thing you need to know is that the local git repository and githubserver are encrypted via SSH.
Run at Terminal
Ozil:tmp mesut$ ssh-vopenssh_6.2p2, Osslshim 0.9.8r 8 Dec 2011usage:ssh [ -1246AACFGKKMNNQSTTVVXXYY] [-B bind_address] [- C Cipher_spec] [-D [Bind_address:]port] [-e Escape_char] [-F configfile] [-i PKCS11] [-i-identity_file] [-l [Bind_address:]port:host:hostport] [-l login_name] [-M mac_spec] [-O ctl_cmd] [-o option] [-P port] [-R] [ Bind_ Address:]port:host:hostport] [-S ctl_path] [-W Host:port] [-W Local_tun[:remote_tun]] [[email protected]] hostname [command]
Obviously the Mac already has SSH installed.
1: Create SSH Key
Enter the current User folder. A wavy line represents the current folder.
Infer whether or not the. SSH is already installed, and avoid installing it before overwriting the default installation.
Obviously the current folder does not have this file
Run Create SSH key
Ssh-keygen-t rsa-c "[Email protected]" (your github login name)
Then all enter, select the default folder, the default password can be
Generating public/private RSA key pair. Enter file in which to save the key (/users/mesut/.ssh/id_rsa): Created directory '/users/mesut/.ssh '. Enter passphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved In/users/mesu T/.ssh/id_rsa. Your public key has been saved in/users/mesut/.ssh/id_rsa.pub.
can then be found in the user's home folder..ssh
folder, inside thereid_rsa
and theid_rsa.pub
Two files, these two are key pairs of SSH key
ozil:~ mesut$ CD. Sshozil:.ssh mesut$ lsid_rsaid_rsa.pub
2: Set SSH key on GitHub
Login to GitHub, "Settings", "SSH Keys", "Add ssh key"
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">
Title: Able to name by the way
key: paste the id_rsa.pub
contents of the file
Click on the Add key to complete the configuration
3: Test whether the local and GitHub connection
Steve
Ozil:.ssh mesut$ ssh-t [email protected]the authenticity of host ' github.com (XXX) ' Can ' T be established. RSA key fingerprint is xxx. Is you sure want to continue connecting (yes/no)? Yes
On the first link to GitHub, there will be a confirmation.you need to confirm that the fingerprint information for GitHub key is really from the server on GitHub, enter
yes
you can get a carriage return.
warning:permanently added ' github.com,xxx ' (RSA) to the list of known hosts. Hi tanchongshi! You've successfully authenticated, but GitHub does not provide shell access.
4: Update to GitHub with a locally created project using Git
Ozil:githubspace mesut$ mkdir hellogithubozil:githubspace mesut$ cd hellogithub/ozil:hellogithub mesut$ Ls-ah...ozil: Hellogithub mesut$ git initinitialized empty git repository in/users/mesut/documents/githubspace/hellogithub/.git/ Ozil:hellogithub mesut$ ls-ah....gitozil:hellogithub mesut$ touch newfileozil:hellogithub mesut$ Lsnewfileozil: Hellogithub mesut$ git add newfile ozil:hellogithub mesut$ git commit-m ' first commit ' [Master (root-commit) 2295d3e] Firs T commit committer: >v< <[email protected]>your name and email address were configured automatically base Don your username and hostname. Please check the that they is accurate. You can suppress this message by setting them explicitly. Run thefollowing command and follow the instructions in your editor to edityour configuration file:git config--global --editafter doing this, your may fix the identity used for this commit with:git commit--amend--reset-author 1 file C Hanged, 0 insertions (+), 0 deletions (-) Create mode 100644 NewFile
First initialize a git repository locally
Because username was not previously configured. So the first commit will be a hint. own initiative to establish
Setup mode
$ git config--global user.name "Your name" $ git config--global user.email "[Email protected]"
To push a local repository to a remote server, you first need to build a project on GitHub
In Repository name, fill in the name of our project. Description, the other default.
The project is then generated
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">
Then associate the remote project with the local library
Ozil:hellogithub mesut$ git remote add origin [email protected]:tanchongshi/hellogithub.gitozil:hellogithub mesut$ git Push-u Origin masterwarning:permanently added the RSA host key for IP address ' XXX ' to the list of known hosts. Counting Objects:3, done. Writing objects:100% (3/3), 217 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (Delta 0) to [email protected]:tanchongshi/hellogithub.git * [New branch] master, Mast Erbranch Master set up to track remote branch master from Origin.
Https://github.com/tanchongshi/hellogithub
So far so good~
Mac uses git to manage GitHub