Question

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://user@github.com': 
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.)

Was it helpful?

Solution

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 git@github.com:your_username/your_project.git 

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

git remote set-url origin git@github.com: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).

OTHER TIPS

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 me@someaddress.com, so I typed: git config --global user.email "me@someaddress.com"

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

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top