Setting username and password returns 'github: command not found'

11,466

Solution 1

You can take a look at this very helpful article : Set up git. You have a section where they explain to you how to save your password.

There is no Github executable, as Github is "just" a website, the message you see is git trying to get your credentials automatically (you can resolve this problem following the guide in the link above).


I want to talk about SSH anyway, because it can be useful to other people arriving here.

Still, the better way to store password is to do not use one and to rather use an SSH key. There's an option in your Github settings to add a new one, with Windows, just generate a key with PuttyGen or alternative, export as an OpenSSH key, and copy/paste it in the text area of Github.
Then clone your repository using the SSH option:

git clone [email protected]:your_username/your_project.git 

Or, if you have an already existant repository, change the url (saw here):

git remote set-url origin [email protected]:your_username/your_project.git

You will not need to type a password anymore, and it is very secure (as long as no one can access your computer and copy the private key).

Solution 2

To set your username: git config --global user.name "[Your USERNAME]"

My username is PyTis, so I typed: git config --global user.name "PyTis"

To test your username settings type: git config user.name To set your email (which is just as important for GitHub) type:

git config --global user.email "[You EMAIL]"

Pretend my email is [email protected], so I typed: git config --global user.email "[email protected]"

To test your email settings: git config user.email

I am sorry, I am not sure how to save the password, but the username, I am sure works.

** Pay attention here, you can apply these settings globally, or just to a specific directory/project. To apply them globally, leave in the global as I displayed above, to apply them locally, simply use the commands when in the directory you wish to apply them to, while omitting the "--global"

A few actual examples below:

(root@pluto)-(/home/jlee/NSIS-Walker)-(12:57 AM Tue May 12)-> (3 files, 60Kb)--> git config user.name "PyTis"

(root@pluto)-(/home/jlee/NSIS-Walker)-(12:57 AM Tue May 12)-> (3 files, 60Kb)--> git config user.name PyTis

(root@pluto)-(/home/jlee/)-(12:57 AM Tue May 12)-> (3 files, 60Kb)--> git config --global user.name "PyTis"

(root@pluto)-(/home/jlee/)-(12:57 AM Tue May 12)-> (3 files, 60Kb)--> git config --global user.name PyTis

Share:
11,466
bevacqua
Author by

bevacqua

Principal Software Engineer at Elastic, helping lead the Elastic Cloud UI team. ● Pre-IPO employee at Elastic, helping drive key initiatives in Elastic Cloud ● Authored 3 books on JavaScript/Node.js application architecture ● Organized first ever Node.js conference in Buenos Aires (NodeConf Argentina) ● Author dragula drag & drop library (20k stars) and prolific open source contributor ● Wrote my own MVC frameworks, clones of async, jQuery, Markdown parsers, and more (purely as a way of learning) ● Grew newsletter on JavaScript to 17k subscribers (Pony Foo Weekly) ● 40k karma on StackOverflow 😅 ● Avid reader Published author of several software development books: Mastering Modular JavaScript (O'Reilly, 2018), Practical Modern JavaScript (O'Reilly, 2017), and JavaScript Application Design (Manning, 2015). Nicolás has vast experience in tackling challenging technical problems, as well as in helping manage teams, driving technical innovation, collaborating across areas, and sharing his applied learning.

Updated on June 12, 2022

Comments

  • bevacqua
    bevacqua almost 2 years

    I have the environment fully working at work, with SSH, but here at home I tend to use more GitHub for Windows instead of Git bash, so that's why it's set up with http.

    github --credentials get: github: command not found
    Username for 'https://github.com': user
    Password for 'https://[email protected]': 
    github --credentials store: github: command not found
    Already up-to-date.
    

    Where can I find and install the github command so I don't have to input my username and password every single time? (I think I probably need to add something to PATH somewhere.)