github usage and configuration

first step

First of all you need to register a github account, otherwise there will be no...

(Before you upload the project, remember to create a new repository name in github to pick it up)
1. Create a new repository


2. Take the name by yourself

second step

 1. Download git: https://git-scm.com/downloads



The third step, configure git 

First create the ssh key locally

1.输入:$ ssh-keygen -t rsa -C "you_email@your_email.com"

2. Enter twice by default (confirm the path and password)


(This email is the email you registered on github)


3. After success, the ~/.ssh folder will appear

Find your folder on the computer, click it, open id_rsa.pub, copy the key inside (you can download a Notepad++ to view this file)


click in




4. Open your github, click Account settings, select SSH Key on the left, add ssh key

title :
any key: paste the key copied in step 5


5. Enter under git bash: $ ssh -T [email protected]

The first prompt yes/no, after selecting yes, it appears: You've successfully authenticated, but GitHub does not provide shell access . This means that you have successfully connected to github.


6. Next, you need to transfer the local warehouse to github. Before that, you need to set usrname and email

$ git config --global user.name "your name"
$ ​​git config --global user.email "your email"
(your github registration name and email address), github will record every commit 


the fourth step

1. Enter the repository to be uploaded, right-click and enter git bash (here second try as the local repository)


$ git init
(initialize this repository to make it git manageable)

Then the folder will show



2. After initialization, add the remote address

$ git remote add origin [email protected]:yourname/second-try.git


(The address here is the address of the library you created on github; you can copy it directly to the place you created yourself)



/* At this point your local repository is composed of three trees maintained by git (working directory/staging area/HEAD)*/

3.$ git add .

(
$git add (filename) /* only add one file here */
&git add . /* add the entire working directory here */
)
At this point, your working directory is added to the staging area, waiting for submission


4. Enter $ git commit -m "1" ("1" is the code submission information, just write it)

/* Commit to HEAD at this time */


5. Submit to the remote repository

$ git push origin master

You can replace master with whatever branch you want to push


6. Open your github and refresh



At this point it is basically a success!


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325763652&siteId=291194637