Git-- Beginner tutorial 1

1.  how to create a new git

open terminal in your linux

###########################################################
#1. open the terminal and create a directory or folder for the project
 ###########################################################

mkdir Demo

###########################################################
#2. enter the directory
###########################################################

cd Demo

###########################################################
#3. create a README.md
###########################################################

touch README.md


###########################################################
#.4initialize the local repository with:
#    let the Demo directory be a local git repo
###########################################################
git init

###########################################################
####5. tell git program. you care about this file 
#### and want to track any changes from this point forward
###########################################################

git add README.md


###########################################################
# when you finished a file or code or part of them,
# you want to pause or end tody's remote
# you can make a commit
# this is similar to a record, when you come back 
# this can note what you revised or edited
###########################################################
git commit -m "this is my first edition"

###########################################################
# add your remote repo URL(your github repo URL) to this local repo
#to connect your computer to GitHub with the command:
#Let's look at this command step by step. We are telling Git to add a remote called origin with the address https://github.com/<your_username>/Demo.git (i.e., the URL of your Git repo on GitHub.com). This allows you to interact with your Git repository on GitHub.com by typing origin instead of the full URL and Git will know where to send your code. Why origin? Well, you can name it anything else if you'd like.
###########################################################

git remote add <short remote name> <remote URL>

#for example:

git remote add origin https://github.com/github-song/Demo.git

#################################################################
# push your local git repo to the remote git repo
#######################################################
git push -u origin master

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值