Article Directory
First, the remote repository GitHub
GitHub is the largest open source hosting platform designed to promote code hosting, version control and collaboration between individuals working on a common project. I think you can GitHub is a local project file synchronization to the remote, while the modification of the contents of the file downloaded to a local platform at the far end.
Git is a distributed version control system,With a Git repository, it can be distributed to different machines. Initially, only a machine with a primitive version of the library, after which other machines can "clone" of the original version of the library, and each machine repositories are actually the same, there is no distinction between them.
At this point, we need to use GitHub , GitHub provides Git repository hosting services , so long as the registration a GitHub account, you can get free remote Git repository.
1.1 configuration and add a remote repository
1. Create SSH Key.
git config --global user.name "ranran-99"
git config --global user.email "[email protected]"
ssh-keygen -t rsa -C "[email protected]"
At this time, found in the user's home directory in the .ssh
directory, there are id_rsa
and id_rsa.pub
two documents, this is the SSH Key secret key pair, id_rsa is private and can not leak out, id_rsa.pub is the public key, can safely tell anyone.
2. At this point, the landing GitHub, open SSH and GPG keys
. Point " Add SSH Key
," fill in any Title, in the Key text box to paste id_rsa.pub
the contents of the file
At this point, you can already see already added Key.
To verify successful, enter the following command ssh -T [email protected]
, the following command shows that we have successfully connected to the Github
[root@server6 repository]# ssh -T git@github.com
Hi ranran-99! You've successfully authenticated, but GitHub does not provide shell access.
3, found in the upper right New repository
button to create a new warehouse
In the Repository name fill in the name of warehouse: repository
Other keep the default settings, click the Create repository
button, you can create a new Git repository.
At this point, we can clone a new warehouse from the warehouse, you can put an existing local repository repository
associated with it, then pushed to GitHub repository.
4, in a local warehouse repository
to run the command git remote add [shortname] [url]
, from the local to associate my remote library
- Virtual machine is available online
git remote add origin git@github.com:ranran-99/repository.git
5, all content push local library to a remote database, essentially the current push to remote branch master
git push -u origin master
6. At this point, you can see in the GitHub page content and local remote databases have been exactly the same
7, from now on, as long as the local were submitted, they can command git push origin master
, the local last modified pushed to GitHub.
GitHub repository from clone 1.2
1, first create a remote repository Ran1
, the default configuration, created after completion, you can see README.md file.
2, the command git clone
cloning a local library
git clone git@github.com:ranran-99/Ran1.git
In this case, look into the directory, the file has been README.md