ubuntu16.04 of GitHub Getting Started Guide
A, Git installation
(1) should first check whether the installed Git
git --versionsudo apt-get install git
(2) If not installed, enter the following command
sudo apt-get install git
(3) SSH authentication
ssh -T [email protected]
If you see
the description may be connected to GitHub.
Two, Git configuration
(1) personal information configuration
git config --global user.name "yaoyunlee"
git config --global user.email "[email protected]"
git config --list
(2) create Github SSH Key
It can be seen only two files in this directory, so at this time does not have a local ssh key, need to create their own
ssh-keygen -t rsa -C "[email protected]"
(3) add public and private keys
id_rsa is private and can not leak out, id_rsa.pub is the public key, you can safely tell anyone
Add the private key to ssh-agent's cache
ssh-add ~/.ssh/id_rsa
Add the public key to Github official website
cat id_rsa.pub
In the GitHub site, then click Settings -> SSH and GPG Keys -> New SSH Key-> Add SSH Key, write a memo SSH authentication name, a string id_rsa.pub file copy into it, pay attention to string no line breaks and spaces.
(4) Check the SSH connection
Note: In the ~ / .ssh directory
enter the command: ssh -T [email protected]
If you see shown above, then add success!
Three, Git usage
1. The project pushed to the remote repository
(1) Create a GitHub repository
to create a repository called Gitest on GitHub
(2) Create a local warehouse
Note: the same name and on the local repository GitHub
git init
Re-initialize the existing Git repository to /home/yaoyunlee/Gitest/.git/
git add .
git commit -m "add readme.txt"
[master fd769ca] add readme.txt
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 README
(3) submit to GitHub
Then enter in your GitHub repository, select Clone with SSH, copy address them.
git remote add Gitest [email protected]:yaoyunlee/Gitest.git
ssh -T [email protected]
Hi yaoyunlee! You’ve successfully authenticated, but GitHub does not provide shell access.
The last local master branch to track the remote branch, submit to GitHub.
git push -u Gitest master
2. cloned from a remote repository
git clone "地址"
addresses that begin with http address can also use git @ the beginning of the copying.
The first blog, a lot of reference to the god of the article, there are deficiencies, continue to improve it! Too late, it can not be written! Continue to fuel it!