Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active October 1, 2021 10:21
Show Gist options
  • Save 4sskick/6dae3f2116e6fe3e48b2fb9acfb76264 to your computer and use it in GitHub Desktop.
Save 4sskick/6dae3f2116e6fe3e48b2fb9acfb76264 to your computer and use it in GitHub Desktop.
based on tutorial in http://stackoverflow.com/a/12800042
and this tutorial to upload existing project into github.
so, you need to create new repository first
Steps:
- make sure you have installed git in your computer
- open the directory project then open CMD in it
- type 'git init'. This will say "Initialized empty git repository in ....git" (... is the path).
- type 'git add .' Dont forget 'pull stop' mark in the end of add after 'space'. I assume you wanna upload a whole file inside the directory.
- type 'git commit -m "massage here for commit"
- type 'git remote add name_of_local_branch[e.g origin] https://github.com/your_username_github/your_repo_name.git
[SINCE 2021 due to latest policy from github (https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/)]
so I already set Token generated
-type 'git remote set-url name_of_local_branch[e.g origin] https://your_token@github.com/your_username_github/your_repo_name.git
- now you've been ready to push, but before that you need to 'git pull' to prevent error
- type 'git pull origin master'. As a new repo, this action should to be executed.
* because this case is firt time commit on fresh repo
* recommend to use this one, 'git pull origin master --allow-unrelated-histories' based on (https://stackoverflow.com/a/58096681)
* when command 'git pull origin master' give you an error. Try command 'git pull --rebase origin master' based on (http://stackoverflow.com/a/41765529)
* when it succeed, you're ready to push your existing project to github
- type 'git push -u origin master'
then upload progress will be processed. Let it finish!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment