My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label mac os. Show all posts
Showing posts with label mac os. Show all posts

Tuesday, March 10, 2026

How to set new Github PTA when old expired

I ran into a situation. My Personal Access Token on Git expired and I wanted to generate and set in my git terminal locally. The problem was that my git was still taking old PTA from command line. I kept on asking for old PTA which was now expired. Let me walk you through what was done next.

But first - Let's learn to set a new Personal Access Token (PAT) on your Mac, you need to first generate it on the GitHub website and then enter it into your terminal when prompted.

Step 1: Generate a New PAT on GitHub

  1. Log into GitHub.com and go to your Settings (click your profile photo in the top right).
  2. On the left sidebar, scroll to the bottom and click Developer settings.
  3. Click Personal access tokens -> Tokens (classic).
  4. Click Generate new token (classic).
  5. Note: Give it a name (e.g., "MacBook Pro").
  6. Expiration: Choose a duration (or "No expiration" if you prefer).
  7. Scopes: Select the repo checkbox (this is required for push/pull access).
  8. Click Generate token and copy the token immediately. You will not be able to see it again.

To update your Personal Access Token (PAT) because Git is still using an old, expired one, you must clear the existing credentials from your system's storage so Git can prompt you for the new one.
1. Clear Old Credentials (Required)
Choose the steps for your specific Operating System:
  • Windows:
    1. Open the Start Menu, search for "Credential Manager", and open it.
    2. Select Windows Credentials.
    3. Find entries for git:https://github.com and click Remove.
  • macOS:
    1. Open Keychain Access (use Command + Space and type it).
    2. Search for github.com.
    3. Right-click the entry and select Delete "github.com".
  • Linux (Command Line):
    • Run: git config --global --unset credential.helper.
    • If you used the "store" helper, delete the credentials file: rm ~/.git-credentials

**But sometimes this step does not work. For that use following:
git remote set-url origin https://github.com


Step 2: Set the Token in your Terminal
Since you already cleared your Keychain earlier, Git will now ask you for the new token the next time you try to connect.
  1. In your terminal, run:
    git pull origin main
  2. Username: Type your GitHub username and press Enter.
  3. Password: Paste your new PAT and press Enter.
    • Note: The terminal will not show any dots or characters while you paste. This is normal security behavior.
But in my case I was getting an error - git pull origin main says fatal: repository 'https://github.com/' not found



Run this command to fix it (replace your-username and your-repo-name with your actual names):
bash
git remote set-url origin https://github.com
Use code with caution.
Now, try to pull again:
bash
git pull origin main
Use code with caution.
What will happen next:
  1. It will ask for your Username: Type it and hit Enter.
  2. It will ask for your Password: Paste your new PAT here and hit Enter. (You won't see any characters appear while pasting).
Why it says "Not Found":
In your previous steps, the remote URL accidentally got set to https://github.com/. GitHub doesn't see any code there, so it tells you the "repository" doesn't exist. Pointing it back to the full URL fixes this. eg: git remote set-url origin https://github.com/Anwar/Artudio

    Permissions Required for Your PAT
    Depending on which type of token you created, ensure these settings are enabled:
    • Fine-grained Token (Recommended):
      • Repository access: Select "Only select repositories" and choose your specific repository (e.g., Anwar-Faiz/artudio), or select "All repositories".
      • Permissions: Under "Repository permissions", find "Contents" and change the access to Read and Write.
      • I also give Pull Request Read and Write
      • Metadata: as Read only


Sunday, February 15, 2026

how to check apache server and php installed or not on mac

 macOS comes with Apache pre-installed, though it may not be enabled by default. You can check its installation and status using the Terminal with the following commands:

  • Check the Apache version: Running the apachectl -v command will display the installed Apache version and build date, which confirms the software is present.
    bash
    apachectl -v
    
  • Check if the Apache service is running: Use sudo apachectl status to see the current status of the Apache service. You can also use the ps aux | grep httpd command to list all running processes related to Apache's executable (httpd).
    bash
    sudo apachectl status
    # or
    ps aux | grep httpd
    
  • Verify the installation via web browser: If the service is running, open a web browser and navigate to http://localhost. If you see the message "It works!", then Apache is installed and serving web pages correctly.
  • Locate the Apache binary: The which command can show the location of the Apache executable in your system's PATH, which is typically /usr/sbin/httpd for the default macOS installation.
    bash
    which httpd
    # or
    whereis httpd
    
If these commands do not work, Apache may not be correctly configured or installed on your system. In such cases, you might consider installing it via a package manager like Homebrew.