[Home] [Growth Mindset] [What is Markdown?] [Coder’s Computer] [Revisions in the Cloud] [Getting Started With HTML] [CSS Beginner Basics] [Dynamic Web Pages With Javascript] [Computer Architecture and Logic] [Programming with JS] [Operators and Loops]
Using Git to Clone a Repository
Photo by Franck V. on Unsplash
What is Git?
Git allows software developers the ability to manage changes in code during project development. Git has many features such as the ability to track changes made locally on a user’s computer and save those changes within project repositories in the cloud. Teams can work on the same project through branching. When a user wants to submit a change to a project repository, a command is typed or executed in the computer’s terminal. The command saves the file(s) in the master branch in the user’s Github account.
What steps do you take to Clone a Repository and Sync Locally?
- Open Github and click on the project repository.
- Click on the green code button and “copy the Clone with HTTPS” URL.
- Open the terminal and type “pwd” to locate where you are at in the terminal. Navigate to home if necessary by typing “cd ~”. Navigate to the location where you will copy your cloned repository and type in the terminal (e.g., “cd documents”).
- Next, type “git clone [insert copied repo link]”. This makes a copy of the repository in your current location in the terminal. If you want to clone within a directory/folder, type the name of the chosen folder immediately after the cloned URL (e.g., “git clone (insert github clone repo link) (insert directory name)”)
- Open Visual Code Studio by typing “code .” and make any changes.
- In the terminal, type “git add [insert filename]”. Note: You may add all changes of all files by executing the “git add *” command.
- If you want to check the status at any time (recommended after each change) type “git status”.
- To commit a file, type “git commit -m ‘description of change’”.
- After that, you mush push this to the github remote repository by typing “git push origin master”.
- Finally, go to the github repository online and check to make sure the changes were made. This may take several minutes due to server lag.