Skip to content

Pushing to repo via Git Bash or Terminal

Thinh Le edited this page Nov 29, 2017 · 1 revision

Do you have the repo?

Run git clone repo-name

Do you want to make your own version?

Go change to the directory cd name then run git init

And then you can add this repo's name to yours as the remote origin (the online repo pretty much) by saying git remote add origin repo-name

Check your remote by git remote -v

You can do git fetch or git pull to get or set the remote repo

Making changes and adding it to the repo

You will do these status steps:

  1. git status to check if there's any files/changes to be staged
  2. git add . or git add file-name to push it to staging
  3. git commit -m "I did this to the files" to commit the staged files to pushing
  4. git push origin master or git push origin branch-name to get those files onto the remote branch on Github

Issues with pushing?

There might be conflicting histories with your branch versus the remote. Try adding the files there onto your local git repo by saying git pull origin master or git pull origin branch-name

If you don't care about the history, then just do git pull origin master --allow-unrelated-histories

There also might be large files that are like 100Mb and you might have to do git LCFS for large files.

Making versions of the repos on our own laptops

I highly recommend making your own branch (version) so we don't conflict with the master branch. You can do so by creating one by git branch branch-name and then git checkout branch-name

You can perform your work there and then push to the origin by git push origin branch-name

Fill in the credentials and you're done.