I usually work from two places and new to git. The very first time i created one repository online and added it to my system like the steps told by the github website. Then i wanted to work on the same repository from my the other place so i installed git in my other system too and did the following:
Created a directory:
Then in that directory i did git init
After that i did git config --global user.name "Name" and git config --global user.email "email"
Then i added the same repository created earlier from other system by getting the address of the repository from HTTPS CLONE URL option in github website as:
git add origin https://github.com/myUserName/repoName.git
Then to get all the repository data i did:
git pull origin master
Till this all works fine i got all the data onto my system, but when i made some changes in the files and committed the changes, I started to push back the changes using the command:
git push origin master
But i was not able to push the changes as it says Error: 403 Forbidden
According to me it gave me such a message because it does not asked me for any username and Password combo, but it asked me for a username and password while pushing when i configured the repository in my first system.
The after doing some Google I found that we can insert Username and Password into a file present in .git/config
So i edited that file as below:
Earlier my config file looks like:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "recupero"]
url = https://github.com/satyam1990/recupero.git
fetch = +refs/heads/*:refs/remotes/recupero/*
After Editing my config file looks like:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "recupero"]
url = https://Username:myPasswordHere@github.com/satyam1990/recupero.git
fetch = +refs/heads/*:refs/remotes/recupero/*
After editing my config file as above I am able to push, but when ever I push changes it displays my Username and Password right away onto my screen and i don't want that. Is there a way such that i can make git to ask me for a Username and Password everytime i git push as it does on my previous system where i configured git the very first time. And also storing Username and Password right away in a text file is not a good practice.