git learning 03

And connect to a remote repository

first step,

  And connect github

1. Create SSH key

  View user's directory in the current directory if there .SSH, whether there are two id_rsa and id_rsa.pub file, if not you need to use git bash get ssh key

 

ssh-keygen -t rsa -c "email@email"

 

2, log on github, open the account setting, ssh key page

Click Add ssh, title can be arbitrarily fill, fill in the contents of id_rsa.pub file in the key.

At this point there will be a local and remote credentials of the connection.

Next, create a repository on github above. (Find create a new repo create a new warehouse, fill in the appropriate name, click Create)

In the local library run git commands

 

Origin git @ the Add Remote git github.com: XXXX / xxx.git
 // XXXX is the account name of git, xxx.git local warehouse, connected to github when this command

 

At this time, the local and connected github

The second step,

  Continued open the contents of the local library was presented to the remote

 

git push -u remote database name master / first 
git push remote library name Master // After again

 

From the remote to the local library clones

1, create a remote library. Such as: gitskills

勾选 Initialize this repository with a readme

2, executed locally

git clone [email protected]: username / remote repository .git name

Branch Management

Create and merge branches

There are two terms before creating, master head pointer head main branch

If you create a branch dev, head pointing to the current branch commit point, and they point to master dev

1, create a branch, and the branch switch to dev

Check Git - B dev
 // create and switch to a branch dev 
or 
Git Branch dev // create a branch 
Git Checkout dev // branch switching

View the current 1.1 branch

git branch

1.2 merging branches

git marge dev

1.3 Delete branch

git branch -d dev

 

Guess you like

Origin www.cnblogs.com/sunshine-2018/p/11349822.html