I want to push README.md to Github.
Using Ubuntu 14.04LTS
So, I commit in the following steps.

echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/user/repo.git
git push -u origin master

But, below error occurred.

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/user/repo.git/info/refs
fatal: HTTP request failed

I know solve this error this way

git remote set-url origin https://username@github.com/user/repo.git

In this way , I must enter password.

$ git push origin master
Counting objects: 24, done.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (24/24), 4.49 MiB | 618 KiB/s, done.
Total 24 (delta 2), reused 0 (delta 0)

Other resources



Set up an account on github and add your first repo named OpenVPN (this example).

Install git

# yum install git

The first step is to specify your username and email address to your GIT repository using “git config” as shown below.

#git config --global user.name "Usernameatgithub"
#git config --global user.email email@atgihub.com

Verify the git configuration information as shown below.

# git config --list

This information is stored in the .gitconfig file under your home directory.

# cat ~/.gitconfig
        name = GIT Admin
        email = ramesh@thegeekstuff.com

If you trying to create a GIT central repository for your company, from where developers can download the projects, you may want to create a username called ‘github’ and organize all your projects under this account. For example: /home/github/gitrepos/project1, /home/github/gitrepos/project2, etc. Once you have the project organized, cd to the project directory, and do ‘git init’ from there as git user.

# cd /home/github/gitrepos
# git init

Once you’ve initialized the project using “git init”, add the folders and files for the projects.

# cd /home/github
# ls

Then, add the files located under this project directory, using “git add”.

# git add -all

Once you’ve added the files to the repository, you should commit those files, as shown below.

# git commit -m 'Initial upload of the project'


git remote add origin https://github.com/username/OpenVPN.git
git push -u origin master