First make sure you have git installed, open git bash, enter ssh-keygen-t rsa-c "own mailbox address @xxx.com", generate your own public key and private key
The default carriage return, the public key, the private key to the following folder Id_rsa is the private key, id_rsa.pub is the public key, open the public key, etc. to use
Browser into your own github, open settings, go to ssh and GPG keys
Click New SSH key, fill in the title yourself, the following copy of the previous open public key, and finally add
You can use Ssh-t [email protected] test Whether you can connect successfully, there is an input in the middle to enter yes, you can see Hi XXXX .... access indicates success.
After the connection is successful, the user information needs to be set
To create a project on github, Remember to create a successful https, the following
-
Git bash go to the local project directory, enter the following command, if the local project directory already has some files to upload, need git add * add, and then git commit-m "XXXX" and git push up, there will be asked user name and password in the middle
To this successful upload GitHub is Over. Hereby record
Attach a collection of common commands:
git common command git init here-create a local repository (repository), will create A. Git folder under the folder, the. git folder stores all the version information, tags and other content git remote add origin [email protected]:winter1991/helloworld.git--associate a local warehouse with a remote REPOSITORY. If you do not execute this command, each push will need to specify the address of the remote server git add--from the local repository additions and deletions, the results will be saved to the native cache git rmgit commit-m "comment"--commit, The contents of the native cache are submitted to the HEAD of the native GIT push Origin master-push the local commit (commit) to the remote server, origin is the previous GIT remote add origin command Origin,origin replaces the server warehouse address: git push [email protected]:winter1991/helloworld.git Mastergit pull Origin master--from the remote service New changes to git status-view status git add-a--commit all Changes 1. git configuration: git config--global user.name "xxx"--configure user name, upload local repository to the server, on Github will display the configured uploader information in git config--glob Al User.email "xxx"--configure the mailbox git config--list view configuration list configuration sshkey: Use this sshkey to confirm upload permissions when uploading code 1. Create a local ssh:ssh-keygen-t rsa-c "Github registered mailbox" 2. Add this sshkey to Github: copy C:\Documents and settings\administrator\.ssh\id_rsa.pub the contents of the file; login to Github--account Setting---ssh-key---Add SSH -key---paste the contents of the id_rsa.pub; 3. Verify: ssh-t [email protected] appears Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. Note the configuration is successful and can be connected to Github 2. Set up warehouse Repository:git init here--create a local repository git remote add origin [email protected]: username/repository name. git --associate the local repository with the remote repository, and if you do not execute this command, you will need to specify the remote Server's address 3 each time you Push. Download new changes from the remote repository: git pull Origin master4. Commit local modifications to the remote repository: git addgit add-a-add changes to the local repository git RM xxx-delete The specified file from the local repository git rm-r xxx-removes The specified folder from the local repository git commi T-m "comment"--commits the contents of the native cache to the HEAD of the native GIT push Origin master--push the local commit to the remote repository 5. Ignore the specified content using The. gitignore file: 1. Create A. Gitignore file at the local warehouse Root. Win7 cannot be created directly, you can create a ". gitignore." file, and the following punctuation is automatically ignored; 2. Filter files and folders: [tt]emp/filter temp\temp folder; *.suo filter. suo file; 3. Do not filter files and FOLDERS:!*.C