Use GitHub under Ubuntu

Install Git

The first step: Check whether the git installation

Git input terminal, shown below are already installed, you can skip step, direct configuration Github

Step two : Install git

sudo add-apt-repository ppa: git-core / ppa 

sudo apt install git 

Step Three: Verify that the installation is complete

In the input terminal or git-version git

 

Configuration GitHub

Provided that there github account, if not registered, click https://github.com/ register an account

git config --global user.name "your github username"

git config --global user.email "github your email address."

 

开始使用GitHub

Step One: Create a local warehouse

For example: New local repository called Mytest in the Documents folder, switch to the first position Ducument directory

cd Documents

mkdir Mytest

The second step切换到Mytest目录下,初始化本地仓库Mytest

cd ~/Document/Mytest

git init

third step:对本地仓库进行更改(任意修改)

比如,添加Readme文件

touch Readme

the fourth step:提交更改

git add Readme

git commit -m 'add readme file'

 

连接github仓库

git remote add origin https://github.com/你的github用户名/你的github仓库.git

git push origin master

 

clone github已有内容到本地仓库

git clone https://github.com/你的github用户名/github仓库名.git

 

更改clone过来的仓库

例如,添加一个新的文件

touch Readme_new

 

依然需要提交更改

git add Readme_new

git commit -m 'add new readme file'

 

Released four original articles · won praise 0 · Views 107

Guess you like

Origin blog.csdn.net/l1079823816/article/details/99297329