Published 2月 21, 2024 by with 0 comment

Git Lab 02 - Getting a Git Repository


Lab 2.1: Initializing a Repository in an Existing Directory
If you have a project directory that is currently not under version control and you want to start controlling it with Git, you first need to go to that project’s directory. 

git init - Create an empty Git repository or reinitialize an existing one

Example Code:
$ cd d:
$ cd Tech/Test_Git/
$ mkdir Project-01
$ cd Project-01/
$ git init


Lab 2.2: Cloning an Existing Repository
If you want to get a copy of an existing Git repository, for example, a project you’d like to contribute. The command you need is git clone.

git clone - Clone a repository into a new directory

Example Code:
$ cd ..
$ git clone https://github.com/libgit2/libgit2 mylibgit


Reference:
1. Git - Commands Reference

2. Git - Getting a Git Repository

3. Git 教程


最初發表 / 最後更新: 2024-02-21 / 2024-02-21

0 comments:

張貼留言