Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Questions and answers begin here Logo Questions and answers begin here Logo
Sign InSign Up

Questions and answers begin here

Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us

g is not recognized as an internal or external command, operable program or batch file (in Windows)

Home/ Questions/Q 428
Next
Answered
g is not recognized as an internal or external command, operable program or batch file (in Windows)
michelles_mommyy
michelles_mommyy Teacher

I have been struggling with running some batch files using the command prompt in Windows 10. Every time I try to execute a batch file named “update.bat”, I get the error message “g is not recognized as an internal or external command, operable program or batch file”. This error is driving me crazy and I have no clue how to solve it.
Here is the code inside the “update.bat” file:
echovectorbravo off
g drive:pathtogitbin
echo Updating repository...
git --git-dir=drive:pathtorepository.git pull origin master
echo Done.

I have already verified that git is installed on my Windows machine and added it to my PATH environment variable. I also tried running the “update.bat” file as an administrator and adding a call to the “git” executable in the batch file, but nothing seems to be working. I am not sure whether there is something wrong with my code or with my system configuration. Can someone please help me figure out what I am doing wrong and how to fix this error? Thanks in advance.

command-lineenvironment-variablesexecutablepathwindows
  • 127
  • 0 Followers
  • 1
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

3 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. alen_dojran Teacher
    2021-12-31T19:53:33+00:00Added an answer about 1 year ago

    One possible solution to the ‘g is not recognized as an internal or external command operable program or batch file’ error is to add the location of the executable to the system’s PATH environment variable. This error usually occurs when the system cannot locate the executable file.
    To do this, follow these steps:
    1. Locate the installation directory of the software that you want to run.
    2. Copy the full path to the installation directory.
    3. Search for ‘Environment Variables’ in the Windows search bar and click ‘Edit the system environment variables’.
    4. Click on the ‘Environment Variables’ button near the bottom of the window.
    5. In the ‘System variables’ section, scroll down until you find the variable named ‘Path’.
    6. Click ‘Edit’ and then ‘New’.
    7. Paste the path of the installation directory you copied earlier into the text box.
    8. Click ‘OK’ on all windows to save the changes.
    This should resolve the issue and enable the system to locate the executable file necessary to run the software. If the issue persists, it may be worth checking for any updates or reinstalling the software completely.

    • 61
    • Reply
    • Share
      Share
      • Share onFacebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. goadjordan Teacher
    2021-12-26T22:04:32+00:00Added an answer about 1 year ago

    If you’re encountering a “g is not recognized” error message, it usually means that you need to add the path to your Git executable to your Windows PATH environment variable. To do this, you should navigate to your Git installation folder, copy the path, and then modify your PATH environment variable to include that path. You can do this by following these steps:

    1. Press the Windows key and search for “Environment Variables” in your Start menu.
    2. Select “Edit the system environment variables”, and then click the “Environment Variables” button.
    3. Under “System variables”, scroll down and find the “Path” variable, and then click the “Edit” button.
    4. Click the “New” button and paste in the path to your Git executable folder.
    5. Click “OK” on all the windows to save the changes you’ve made to the PATH environment variable.

    Once you’ve completed these steps, try running your git command again and the “g is not recognized” error should be gone. If this solution still does not work for you, please provide more information about your environment and the specific error messages you’re getting so we can help you further.

    • 41
    • Reply
    • Share
      Share
      • Share onFacebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  3. Best Answer
    zhengal Teacher
    2021-12-20T09:44:25+00:00Added an answer about 1 year ago

    Hi there! It sounds like you’re having trouble with the ‘g’ command not being recognized as a valid command. This is a common issue for many developers, particularly those who are just starting out with coding. The reason for this is that ‘g’ is not a standard command in most operating systems, so it needs to be installed separately.
    First, check to see if you have installed Git on your local computer. Git is the most common way to install the ‘g’ command, and it’s required for development on many platforms. If you haven’t installed Git yet, you can download it from the official website and follow the installation instructions.
    Once you have Git installed, you should be able to use the ‘g’ command in your terminal or command prompt without any issues. If you’re still having difficulties, try checking your PATH environment variable to see if the correct path to Git is included. The PATH variable is what your operating system uses to locate commands and applications, so it’s possible that your system isn’t finding Git properly.
    Another possible solution is to try using a different terminal or command prompt. Some terminals and command prompts have quirks or limitations that can cause issues with certain commands, so it’s always a good idea to test your code in multiple environments to ensure compatibility.
    If you’re still having trouble with the ‘g’ command, it’s possible that there may be an issue with your local installation or configuration. In this case, it may be helpful to seek out additional resources, such as online forums or documentation, to help troubleshoot the issue.
    Overall, the ‘g’ command not being recognized is a common issue that many developers face. By following the steps above and checking your installation and configuration, you should be able to resolve the issue and continue your development work with confidence. Good luck!

    • 31
    • Reply
    • Share
      Share
      • Share onFacebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.