Tho Le

A Data Scientist. Looking for knowledge!

Some Tips for using Github

06 Feb 2025 » tools

Create a Virtual Env for Every New Project

  • python -m venv your_env_name
  • your_env_name\Scripts\activate

Git Push

  • git remote add origin https://github.com/tom-tin/deploy_streamlit
  • git status
  • git add .
  • git commit -m 'message'
  • git push --set-upstream origin master

Git Pull

  • error: Your local changes to the following files would be overwritten by merge: logs/dbt.log
    • Confirm that issue is to “Changes not staged for commit”: run git status
      • In my case, it is due to this file “logs/dbt.log” was not staged and committed. I don’t want to.
      • For some people, there were no such a file and this error still occurs. Same solution here.
    • Delete the problematic file (here, dbt.log)
    • Run git reset --hard
    • Confirm that there is no more changes needed to be staged: run git status
    • Retry run git pull
    • Source

Use Multiple GitHub Accounts in VS Code

Can use different ways. Other than config the settings, here is another option.

  • Log in to VS Code with Account 1.
  • Download the portable version of VS Code and log in with Account 2.
  • If you are using one account and running into authorization issue during a commit, try adding the other account as the Collaborator of the repo then try to commit again.