How to Set Up Your Git Workspace on a PC

How to Set Up Your Git Workspace on a PC


Today’s post is all about the command line. It doesn’t matter if you have a PC or a Mac. You can use the command line on any type of computer you have.

I have a PC so I’ll be using the PC commands. I learned how to use the command line in Skillcrush 104 when I began learning Ruby. This was very frustrating to use because every command I tried wouldn’t work for me.

I wanted to pull my hair each time I got an error. Despite the frustration, I didn’t give up, and it gradually became easier. Today I am much better and get fewer errors.

If you get frustrated in this lesson, you aren’t alone. Just take a deep breath and then try again.



Introducing the Command Line

The command line (also known as the terminal or console) is an “interface you can communicate with the computer using text commands”. This is the definition Skillcrush gives their students. It means that the commands you write are written in a way the computer will understand.

Keep in mind computers communicate differently than we do so developers have to interact in a way they can understand. You are using a browser which is an example of GUI in action. GUI (graphic user interface) is what people are used to using because it is the user display on the computer. 

You can think of the GUI as how people use computers. Other examples of GUI in action are menus, buttons, and windows. The command line is the opposite since it uses text for the commands.

While GUI is commonly used, the earliest computers used the command line to talk to the computer. Although the GUI does get used, developers still use the command line. Some of the reasons are:



It is faster than the GUI. 

Remember, the purpose of coding is being able to talk to your computer in a language it can understand. As you learn more about Git, you can type a press a few keys to do specific commands, meaning fewer words. In contrast, using the GUI gives the computer more work. 

This means when you type a command, the computer has to translate your code into a graphical format. Skillcrush says it is like using a language translator to translate English into another language instead of just speaking the language.



Git is meant to be run in the command line. 

Git can run natively or operate in a particular environment. That is another way of saying it was designed to work in specific environments. Git can be used by the GUI, but it won’t have many features. 



The tech industry expects you to. 

There is a reason why there are so many job postings asking for Git and the command line. You’ll be using it a lot as you work on projects and work on teams. So you will need the experience because it is used for other applications.



Set Up Git on a PC

It doesn’t matter what version of Git you are downloading or what version of Windows you have.  Before you can start, you will need to install Git Bash. Although computers does provide you the terminal to use on your computer, you need Git Bash because it lets you use Git commands.

Once Git Bash is downloaded, you’ll create a username and add your email to your Git account. This connects to any changes you make to a repo so people can see and know who made those changes. Skillcrush recommends the username be clear and professional so people know who made changes. So don’t do what I did and instead use your name somehow as your username.

  1. Download Git Bash. This is a tool developers use to write Git commands on a PC. I use this on my computer. Just go to gitforwindows.org and click the download button to start downloading the file.
  2. Once the download is complete, find the .exe file in the web browser or the downloads folder.
  3. Click start so you can start the setup process. The setup window should open by now.
  4. Once it is open, click the next button in the next few windows to agree to the Git Bash settings.
  5. Continue to click next until you get to the install button. Then click this button. Let your computer install Git.
  6. Once it is finished, uncheck the “View Release Notes” at the last window then click the Finish button.

Now you have Git Bash installed on your computer. You can find Git Bash by typing “Git Bash” in the search box on Windows. You can also create a shortcut to Git Bash by right-clicking on it and picking the “Pin to the Taskbar” option. 

Click the icon to open the command line and start writing your commands. If you want to check what version you have, you can type “git -version” command and then press Enter. The computer should then show you the version it has installed on your PC. 



Configure your environment

Now you can create a user name and pick an email for your Git account. Don’t forget to try using a clear and professional name. If your name or email doesn’t appear or you just made a typo, repeat steps 2-3 again.

  1. Make sure your command line of choice is open.
    Type “git config  – – global user.name” with your name in quotes. So it might look like “git config –global user.name “sarah_d”. Click enter when you are done.
  2. Type “git config – – global user.email” with your email in quotes. It would look like “git config –global user.email “sarahdye@example.com”. Click enter when you are done.
  3. You will want to verify your name and email. Type “git config user.name” then click enter. You should see your name. Then type “git config user.email” to see your email.



Conclusion

Woohoo! Your Git workspace is now set up and you have already used some commands in Git Bash. Congratulations! 

Now you are ready to start working in the command line. The next lesson is going to dive deeper into working on the command line. You’ll learn more commands you can use and will get practice applying those commands in Git Bash. You will particularly learn how to move around the command line to find folders and files.

This post was written on January 15, 2025.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *