Skip to main content
added 111 characters in body
Source Link
primegxy
  • 1.8k
  • 20
  • 24

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your & your team-mate's commit history. So please dont do this on professional project

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.As you might have guessed, manipulating master is not a good thing. So simply replace it with the branch name you want to work on. Or create a new one git checkout -b fix-something

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your & your team-mate's commit history. So please dont do this on professional project

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your & your team-mate's commit history. So please dont do this on professional project

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

As you might have guessed, manipulating master is not a good thing. So simply replace it with the branch name you want to work on. Or create a new one git checkout -b fix-something

Added more explanation
Source Link
primegxy
  • 1.8k
  • 20
  • 24

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your & your team-mate's commit history. So please dont do this on professional project

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your commit history

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your & your team-mate's commit history. So please dont do this on professional project

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

added 57 characters in body
Source Link
primegxy
  • 1.8k
  • 20
  • 24

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended solution

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

(Not Recommend)

Solution 2 (Not Recommend) :

Will Delete all your commit history

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended solution

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

(Not Recommend)

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

First and simple solution:

  • Try this command git push -f origin master.
  • This command will forcefully overwrite remote repository (GitHub)

Recommended Solution 1 :

  • Run these commands:
git pull --allow-unrelated-histories  //this might give you error but nothing to worry, next cmd will fix it
git add *
git commit -m "commit message"
git push

If this doesn't work then follow along 🔰

Solution 2 (Not Recommend) :

Will Delete all your commit history

  • Delete .git directory from the folder.

  • Then execute these commands:

      git init
      git add .
      git commit -m "First Commit"
      git remote add origin [url]
      git push -u origin master
    

OR

git push -f origin master 

Only use git push -f origin master if -u dont work for you.

This will solve almost any kind of errors occurring while pushing your files.

added 2 characters in body
Source Link
primegxy
  • 1.8k
  • 20
  • 24
Loading
Simplify language to explain briefly
Source Link
primegxy
  • 1.8k
  • 20
  • 24
Loading
added 88 characters in body
Source Link
Chris Stryczynski
  • 32.6k
  • 54
  • 197
  • 311
Loading
deleted 25 characters in body
Source Link
primegxy
  • 1.8k
  • 20
  • 24
Loading
added 194 characters in body
Source Link
primegxy
  • 1.8k
  • 20
  • 24
Loading
better readability
Source Link
Eric Aya
  • 69.9k
  • 36
  • 188
  • 256
Loading
Source Link
primegxy
  • 1.8k
  • 20
  • 24
Loading