|
| 1 | +If not using SSH, following methods can be used: |
| 2 | + |
| 3 | +Method1: |
| 4 | +***************** |
| 5 | + |
| 6 | +git-credential-store - Helper to store credentials on disk |
| 7 | + |
| 8 | + # git config --global credential.helper cache |
| 9 | + |
| 10 | +The credential.helper cache value tells Git to keep your password cached in memory for a particular amount of minutes. The default is 15 minutes, you can set a longer timeout with: |
| 11 | + |
| 12 | + # git config --global credential.helper "cache --timeout=3600" |
| 13 | + |
| 14 | +Which sets the cache for 1 hour, or: |
| 15 | + |
| 16 | + # git config --global credential.helper "cache --timeout=86400" |
| 17 | + |
| 18 | +Note that: |
| 19 | +Using git config --global credential.helper store is not safe as it stores the Github password in clear text. For Linux, libsecret is an excellent alternative. |
| 20 | +For Ubuntu and some other linux distributions you can do the following: |
| 21 | + |
| 22 | +Install: |
| 23 | + |
| 24 | +sudo apt-get update |
| 25 | +sudo apt install libsecret-1-0 libsecret-1-dev |
| 26 | +sudo apt install gnome-keyring |
| 27 | + |
| 28 | +Create |
| 29 | + |
| 30 | +cd /usr/share/doc/git/contrib/credential/libsecret/ |
| 31 | +Sudo make |
| 32 | + |
| 33 | +Configure git to store passwords using libsecret |
| 34 | + |
| 35 | + # git config --global credentail.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret |
| 36 | + |
| 37 | + |
| 38 | +if you're on Mac OS X and used Homebrew to install Git, you can use the native Mac OS X keystore with: |
| 39 | + |
| 40 | + # git config --global credential.helper osxkeychain |
| 41 | + |
| 42 | +For Windows, there is a helper called Git Credential Manager for Windows or wincred in msysgit. |
| 43 | + |
| 44 | + # git config --global credential.helper manager |
| 45 | + |
| 46 | + |
| 47 | +Method2: |
| 48 | +****************** |
| 49 | +On Windows operating system You can use : |
| 50 | + |
| 51 | +https://{Username}:{Password}@github.com/{Username}/{repo}.git |
| 52 | + |
| 53 | +eg: |
| 54 | + |
| 55 | +git clone https://{Username}:{Password}@github.com/{Username}/{repo}.git |
| 56 | + |
| 57 | +git pull https://{Username}:{Password}@github.com/{Username}/{repo}.git |
| 58 | + |
| 59 | +git remote add origin https://{Username}:{Password}@github.com/{Username}/{repo}.git |
| 60 | + |
| 61 | +git push origin master |
| 62 | + |
| 63 | +Method3: |
| 64 | +********************* |
| 65 | + |
| 66 | +git remote set-url --push origin https://<username>:<password>@github.com/<repo> |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +Reference : https://git-scm.com/docs/git-credential-store |
0 commit comments