Deploy your project to Github or Coding using git

What is GitHub or Coding

Both of them is a software development platform which is pretty powerful. Coding's server is located in China, so it will be loaded faster than GitHub if you are in China, while Github's server is in the United States. We can put our code to those platforms so that we can have a good command of our projects such as reviewing your code, retrieving an old version of our project and so on. If you want to have a full understanding of GitHub, here is a Wikipedia Link about GitHub.

Git

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for source code management in software development,
but it can be used to keep track of changes in any set of files. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.

Install git

Choose your system to install it.

Linux

Running the following command in the terminal.

  • Ubuntu/Deepin/Debian/Linux Mint
    sudo apt-get install git
  • Fedora, CentOS 或 RHEL
    sudo yum install gitorsudo dnf install git
  • Archlinux
    sudo pacman-S git
  • OpenSUSE
    sudo zypper install git
  • Gentoo
    emerge --ask --verbose dev-vcs/git

In addition to installing it in your terminal, you also can install it through compiling its source code.
Before you compile git, you should download its dependencies packages.

  • Debian, Ubuntu 或 Linux Mint
sudo apt-get update
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc xmlto docbook2x
  • Fedora, CentOS 或 RHEL
$ sudo yum update
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

Download source code and compile

$ wget https://codeload.github.com/git/git/zip/v2.14.2
$ unzip git-2.14.2.zip
$ cd git-2.14.2
$ make prefix=/usr/local/git all 
$ make prefix=/usr/local/git install

Add git's path into environment variable
sudo vim /etc/profile
And then add the following line into the last line of the file.
export PATH=/usr/local/git/bin:$PATH
Make it work
source /ect/profile

Window

Download git for windows from its official website.
After installing, you can use it in the terminal.

Deploy your project to the Github or Coding

After the installing procedure, you can use it now.

Configure your git

set your personal information so that others can recognize you

git config --global user.name “your name”
git config --global user.email “email”

Using SSH

If you don't want to type account and password every time you push your project to Github, you can use SSH.
In the page, click the new SSH key button to create an SSH key.
If you are using Linux, open your terminal. Open Git Bash if you are using Windows. Then type ssh-keygen -t rsa -C "your_email".

generate_SSHKEY.png

After doing this, you can find two files(id_rsa id_rsa.pub) are generated in the .sshdirectory.Copy the content of id_rsa.pub to github.
Type ssh -T git@github.com to test whether it is work or not.(see more information about generating SSH Key.)
new_sshkey.png

test.png

Github

First, create a repository for your project in the Github.

You can choose your repository to keep public or private.The latter need to pay, and the former is free. You can add a short sentence to describe your project in the Description column.It is optional for you to create a Readme file which aims to tell other what is your project and how to use your project. After creating a new repository, you will see the following picture.


Initialize your repository tip

Create a new repository

cd <target directory> //for example `cd /home/demo`
git init              //In the directory initialize a local repository
git add README.md //If you have a README.md file, you can add it to the repository.
git commit -m "first commit" //This command tends to commit your project into the local repository. Write your change in your project with the braces.
git remote add origin https://github.com/strivexj/demo.git // Establish a connection between your local repository and the Github's repository
git push -u origin master //This command tends to commit your project to Github's repository. -u means set upstream, you only need to add it in the first time.

Or push an existing repository from the command line

If you have a local repository, you can use the following command to directly add your project to the Github's repository you just created.

git remote add origin https://github.com/strivexj/a.git
git push -u origin master

After running git push -u origin master , it will pop up a window, or in the terminal to ask you to type in account and password, you should type your Github's account and password.

Git common command

git init
git add [filename] // If you want to add all file, you can use `git add .`
git commit 
git push   //such as git push origin master, replace origin with your repository's branch name you have set.
git log   //show commit logs
git status //show the working tree status
git fetch //download objects and refs from another repository
git pull //fetch from and integrate with another repository or a local branch
git remote set-url origin url //if you want to change your remote repository, you can use this command

Coding

The procedure of Coding is the same as Github, if you have understood how to use Github, you can do the same to deploy your project to the Coding platform.

Ending

Thanks for your reading. If you find my article have some errors or something you don't understand, please feel free to contact me. In addition to the article, if you find my English have some grammar mistakes, I will appreciate it if you could correct me. I have tried my best to improve my English. Thank you again.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末揩懒,一起剝皮案震驚了整個(gè)濱河市肥哎,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌飞蛹,老刑警劉巖漾肮,帶你破解...
    沈念sama閱讀 219,270評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件厂抖,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡克懊,警方通過(guò)查閱死者的電腦和手機(jī)忱辅,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,489評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)谭溉,“玉大人墙懂,你說(shuō)我怎么就攤上這事馍忽ⅲ” “怎么了?”我有些...
    開封第一講書人閱讀 165,630評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵盅粪,是天一觀的道長(zhǎng)柜与。 經(jīng)常有香客問(wèn)我场躯,道長(zhǎng),這世上最難降的妖魔是什么旅挤? 我笑而不...
    開封第一講書人閱讀 58,906評(píng)論 1 295
  • 正文 為了忘掉前任踢关,我火速辦了婚禮,結(jié)果婚禮上粘茄,老公的妹妹穿的比我還像新娘签舞。我一直安慰自己,他們只是感情好柒瓣,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,928評(píng)論 6 392
  • 文/花漫 我一把揭開白布儒搭。 她就那樣靜靜地躺著,像睡著了一般芙贫。 火紅的嫁衣襯著肌膚如雪搂鲫。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,718評(píng)論 1 305
  • 那天磺平,我揣著相機(jī)與錄音魂仍,去河邊找鬼。 笑死拣挪,一個(gè)胖子當(dāng)著我的面吹牛擦酌,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播菠劝,決...
    沈念sama閱讀 40,442評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼赊舶,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起笼平,我...
    開封第一講書人閱讀 39,345評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤园骆,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后寓调,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體遇伞,經(jīng)...
    沈念sama閱讀 45,802評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,984評(píng)論 3 337
  • 正文 我和宋清朗相戀三年捶牢,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了鸠珠。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,117評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡秋麸,死狀恐怖渐排,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情灸蟆,我是刑警寧澤驯耻,帶...
    沈念sama閱讀 35,810評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站炒考,受9級(jí)特大地震影響可缚,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜斋枢,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,462評(píng)論 3 331
  • 文/蒙蒙 一帘靡、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧瓤帚,春花似錦描姚、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,011評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至怯邪,卻和暖如春绊寻,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背悬秉。 一陣腳步聲響...
    開封第一講書人閱讀 33,139評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工澄步, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人搂捧。 一個(gè)月前我還...
    沈念sama閱讀 48,377評(píng)論 3 373
  • 正文 我出身青樓驮俗,卻偏偏與公主長(zhǎng)得像懂缕,于是被迫代替她去往敵國(guó)和親允跑。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,060評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容