Local git issue after adding a new post with netlify CMS
I use to work localy with the git very basic commands bellow
to add stuffs on my GitLab repo:
git init
git status
git add .
git commit -m “”
git push -u “” master
And it was fine. But, two weeks ago i try netlify CMS to make some changes on my blog section.
Since then i can’t use git commands localy like i use to.
So i tried this command, but it failed:
@N1 03tz % git remote add origin https://gitlab.com/ferreiraf/03tz.git
fatal: remote origin already exists.
Appreciate your help, thank you.
Heya and welcome to Gitlab community.
You have two possible solutions for this.
Solution 1: Remove the origin since it already exists:
git remote rm origin
git remote add origin https://gitlab.com/ferreiraf/03tz.git
Solution 2: Replace the current origin URL with a new one.
git remote set-url origin https://gitlab.com/ferreiraf/03tz.git
Thanks for the solutions.
When i try the solution 1, i get this:
flavioferreira@N1 03tz % git remote rm origin
flavioferreira@N1 03tz % git remote add origin https://gitlab.com/ferreiraf/03tz.git
flavioferreira@N1 03tz % git push -u "https://gitlab.com/ferreiraf/03tz.git" master
To https://gitlab.com/ferreiraf/03tz.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitlab.com/ferreiraf/03tz.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Have you tried git pull
and then git push
again?
Yes i already tried.
At first this morning i began with this commands:
git init
git pull
git status
git add .
git commit -m “”
git push -u “” master
git remote add origin https://gitlab.com/ferreiraf/03tz.git
When i try git pull now, i have this result:
flavioferreira@N1 03tz % git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
flavioferreira@N1 03tz %