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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:43:00+00:00 2026-06-15T13:43:00+00:00

So if.. $ git config user.name ↳ Alex Gray # OK (my name) $

  • 0

So if..

$ git config user.name
↳ Alex Gray              # OK (my name)
$ git config user.email
↳ alex@mrgray.com        # OK (my email).

and..

GithubUserForProject() {  # in pwd
    ORIGIN=$(git config --get remote.origin.url) && echo $ORIGIN
    OWNER=${ORIGIN%/*}     && echo $OWNER  # trim URL tail
    OWNER=${OWNER#*.com/}  && echo $OWNER  # trim URL head
    OWNER=${OWNER#*:}      && echo $OWNER  # trim ssh URL head
}

$ cd /local/git/MyGitHubRepo && GithubUserForProject
↓ git@github.com:mralexgray/MyGitHubRepo.git
↓ git@github.com:mralexgray
↳ mralexgray            # OK (my username, but skanky way of finding it) 

but…

$ cd /local/git/SomeGuysProject && GithubUserForProject
↓ git://github.com/someguy/SomeGuysProject.git
↓ git://github.com/someguy
↳ someguy              # WRONG! (cloned repo's user!)

So, how can I determine my github “short username” programmatically, either from the environment, a github API request, etc., or otherwise (via a script or terminal session?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:43:01+00:00Added an answer on June 15, 2026 at 1:43 pm

    I thought it silly that such an inane question go so glaringly unsolved… so for lack of knowing how to cleverly parse strings in bash without resorting to the one SED combo I know by heart, and……

    security find-internet-password -s github.com | grep acct | sed 's/"acct"<blob>="//g' | sed 's/"//g'

    ét voila….

    mralexgray

    This may depend on having the Github mac client installed… and yet again… it might not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up my name and email as follows git config --global user.name
Let's say I make a repo cd repo1 git init git config user.name Jack
I installed Git and ran the set up my username and email. git config
I use Git on Windows and set the username and email with: git config
I have this small script that checks if a user name and email exist
How can I delete all existing git aliases at once? I tried git config
I have the following directory structure: project/ .git/ ... app/ ... config/ initializers/ braintree.rb
newbie for clearcase. Since clearcase's config is rather different from other concept in git,
Following the installation instructions , I added #depts [SonataAdminBundle] git=git://github.com/sonata-project/SonataAdminBundle.git target=/bundles/Sonata/AdminBundle version=origin/2.0 And #app/config/config.yml
git clone supports both HTTPS and SSH remote URLs. Which should I use? What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.