Synchronize code from Linux to the GitHub code repository
I believe that anyone who knows about the GIT software can host your git version library on github. The function is similar to SourceForge and Google Code. The github interface is very user-friendly, git itself is more complex than svn, so github is more difficult to operate than SourceForge. So I recorded the synchronization process in the Linux environment. The steps for registering an account are skipped.
Prerequisites:
Make sure that the server has installed git. If not, perform the following operations:
Yum install git
If
No package git available.
First install the relevant source, refer to the following:
CentOS5.x 32-bit (x86/i386 ):
Rpm-Uvh http://dl.Fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
CentOS5.x 64-bit (x64 ):
Rpm-Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
CentOS6.x32-bit (x86/i386 ):
Rpm-Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
CentOS6.x 64-bit (x64 ):
Rpm-Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
1. register an account on github
Omitted
2. After creating an account, create a new repository on github, as shown in
III,
Configure the local SSHKEY for remote connection to the local machine (1. Check the generation of the local ssh key; (if "No such file or directory" or similar statements appear, the ssh key is missing)
The command to generate the KEY is as follows:
$ Cd ~ /. Ssh
$ Ssh-keygen-t rsa-C "emailaddress" (add your own email address to emailaddree)
(Note) if the above prompt is displayed, the system will prompt you to press enter and enter the password. We recommend that you press enter along the way to press the default value.
4. Add an ssh key to github
(1. If you have multiple computers to synchronize code, we recommend that you enter the title as a place name and try not to use Chinese characters.) (2. In the key box, please check in the home folder. ssh/id_rsa.pub: Copy all the text in the file to the Key box;
So far, the github configuration is complete. Next we will perform a synchronization test
5. Create a synchronization folder in any local directory
$ Cd ~
$ Mkdir test
$ Cd test
$ Git clone git@github.com: xxxx/test (Note: xxxx here is your own account name, test is your repository name created in github)
6. After successful synchronization, test whether the upload is successful:
$ Touch test1
$ Git add test1
$ Git commit-m "test"
7. Next we will push the locally modified code to the github code repository.
$ Git push
So far, our github has been configured and can be used.
8. Attach common git commands for use here:
Git clone <address>: copy the code library to your local computer;
Git add <file>...: add a file to the code library;
Git rm <file>...: delete the files in the code library;
Git commit-m <message>: Submit the changes. After modifying the file, use this command to submit the changes.
Git pull: Synchronize code library from remote to local.
Git push: pushes code to a remote code library.
Git branch: view the current branch. The belt * is the current branch.
Git branch <branch-name>: Creates a new branch.
Git branch-d <branch-name>: delete a branch.
Git checkout <branch-name>: switch to the specified branch.
Git log: view the commit record (that is, the history commit record ).
Git status: the current modification status, whether the modification has not been submitted, or the files are not used.
Git reset <log>: returns to the previous version.
GitHub Tutorials:
Create a personal technical blog via GitHub
GitHub tutorials
Git tag management details
Git branch management
Git remote repository details
Git local Repository (Repository) Details
Git server setup and Client installation
Git Overview
Share practical GitHub tutorials
GitHub details: click here
GitHub: click here
This article permanently updates the link address: