I am pushing data to github. When I push data i am facing problem.I am pushing data using this.
git init
touch README.md
git add .
git commit -m "initial commit"
git remote add origin https://github.com/YourAccount/firstPush.git
git push -u origin master
Actuall I run  git remote add origin https://github.com/YourAccount/firstPush.git this command wrong.
When I again push data with correct path I got error 
fatal: remote origin already exists.
                Use the git remote rm command to remove a remote URL from your repository.
In order to change the URL of a Git remote, you have to use the “git remote set-url” command and specify the name of the remote as well as the new remote URL to be changed. For example, let's say that you want to change the URL of your Git origin remote.
You can follow any of the following 3 methods:
Remove the old origin and readd the correct one:
git remote remove origin
git remote add origin <correct address>
Update the existing remote links:
git remote set-url origin <correct url>
you can optionally provide --push to the above command.
Update the remote section of your .git/config file:
[remote "origin"]
    url = <correct url>
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
You can also refer to git documentation for the git remote commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With