How to start your project with github

Change the current working directory to your local project.
Before initialize git, make .gitignore file. This makes git to ignore some unwanted files or folders.
Then, initialize git, add files, commit the files.
git init
git add --all
git commit -m 'Initial commit'
Add new github repository and check the url. (e.g. https://github.com/youraccount/repo_name.git)
Add this remote repository to git and check it. (You can choose <name> of the remote repo.)
git remote add <name> <url>
git remote -v
Pull & Push
git pull <name> <branch_name> --allow-unrelated-histories
git push <name> <branch_name>
Now you have your own github repository connected with your working project.

**Comment for --allow-unrelated-histories: You made your local git repository and remote git repository separately. Thus, the base of two branches(local master branch and remote master branch) are different. Git does not allow merging these branches by default so you need --allow-unrelated-histories option.

댓글