-1

My github personal access token is expired in android studio and I want to commit more code but now I cant . It is showing

hint: Updates were rejected because the remote contains work that you do  
hint: not have locally. This is usually caused by another repository pushing  
hint: to the same ref. You may want to first integrate the remote changes  
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 !  refs/heads/master:refs/heads/master [rejected] (fetch first)  
Done

Please help what to do now , and best practice using github access tokens .

torek
  • 448,244
  • 59
  • 642
  • 775
Satendra Pal
  • 31
  • 1
  • 4
  • https://stackoverflow.com/search?q=%5Bgit%5D+hint%3A+Updates+were+rejected+because+the+remote+contains+work+that+you+do – phd Nov 15 '21 at 09:31

1 Answers1

1

It seems that it has nothing to do with android studio or token expiration but someone else has pushed a commit on your branch which you do not have locally.

just open the terminal, cd into the repo and run:

git pull 
git push origin HEAD

If you have conflicting local files look into this answer for more Git: How do I force "git pull" to overwrite local files?