Setting username and password returns 'github: command not found'
Asked Answered
L

4

7

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.)

Libation answered 29/10, 2012 at 14:58 Comment(1)
This error pops up because your git.exe in the path is the one that comes with github with windows but rest of the tools are not in the path.Afterheat
B
2

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).

Barge answered 29/10, 2012 at 15:7 Comment(2)
Please use git remote set-url origin ... instead of git config. It's more clear in what it does.Mendie
@Nico You should make this an answer to your own question ;)Electrodynamic
A
1

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

Alban answered 29/10, 2012 at 14:58 Comment(0)
A
1

There is in fact a github executable and it's being used for automatic login in this case.

The current state seems to be having installed Github for Windows (Github Desktop) and having added its version of git to the PATH variable. (If another reader hasn't, you can find out how to do that here.)

To find out where this mysterious github executable is located, fire up the Git Shell that installed along with Github for Windows and type the command which github.

On my system it spit out this path, on yours it'll be different:

/c/Users/Admin/AppData/Local/Apps/2.0/W25VPZXO.O5Y/DC9K5M2B.KL1/gith..tion_317444273a93ac29_0003.0003_5794af8169eeff14/github

That's a Linux style path pointing to the github executable.

Change it to a Windows style path by changing the starting /c/ to C:\ (or whatever else your drive letter might be), changing the forward slashes to backwards slashes and knocking off the trailing /github to get the directory.

For me, it's this, again, on your system it'll be different:

C:\Users\Admin\AppData\Local\Apps\2.0\W25VPZXO.O5Y\DC9K5M2B.KL1\gith..tion_317444273a93ac29_0003.0003_5794af8169eeff14

Add that to (the end of) your path and you should be able to use git commands without the need to fill in credentials. (You still need to have set them once in Github for Windows though.)

Aleida answered 2/7, 2017 at 20:57 Comment(0)
K
0

If you're cloning GitHub repositories using HTTPS, you can use a credential helper to tell Git to remember your GitHub username and password every time it talks to GitHub.

With Git for Windows, running the following in the command line will store your credentials:

$ git config --global credential.helper wincred

For more read

Keyek answered 16/8, 2017 at 12:27 Comment(2)
just tried that as my 1st attempt, going to docs, but that command did nothing here, and so I came to stackoverflow seeking for the answer! :pLycanthropy
@Lycanthropy Sorry, did not help youMaurreen

© 2022 - 2024 — McMap. All rights reserved.