forked from Sonal0409/DevOps_ClassNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushNoCredentials
More file actions
70 lines (38 loc) · 1.97 KB
/
PushNoCredentials
File metadata and controls
70 lines (38 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
If not using SSH, following methods can be used:
Method1:
*****************
git-credential-store - Helper to store credentials on disk
# git config --global credential.helper cache
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:
# git config --global credential.helper "cache --timeout=3600"
Which sets the cache for 1 hour, or:
# git config --global credential.helper "cache --timeout=86400"
Note that:
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.
For Ubuntu and some other linux distributions you can do the following:
Install:
sudo apt-get update
sudo apt install libsecret-1-0 libsecret-1-dev
sudo apt install gnome-keyring
Create
cd /usr/share/doc/git/contrib/credential/libsecret/
Sudo make
Configure git to store passwords using libsecret
# git config --global credentail.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
if you're on Mac OS X and used Homebrew to install Git, you can use the native Mac OS X keystore with:
# git config --global credential.helper osxkeychain
For Windows, there is a helper called Git Credential Manager for Windows or wincred in msysgit.
# git config --global credential.helper manager
Method2:
******************
On Windows operating system You can use :
https://{Username}:{Password}@github.com/{Username}/{repo}.git
eg:
git clone https://{Username}:{Password}@github.com/{Username}/{repo}.git
git pull https://{Username}:{Password}@github.com/{Username}/{repo}.git
git remote add origin https://{Username}:{Password}@github.com/{Username}/{repo}.git
git push origin master
Method3:
*********************
git remote set-url --push origin https://<username>:<password>@github.com/<repo>
Reference : https://git-scm.com/docs/git-credential-store