The questions below assume that you’re using GitHub. Mileage may vary if you’re using another internet git provider.
How do I connect a local repo to a remote repo?
Let’s say you’ve created a local repository on your machine, but there is no corresponding remote repository.
- On GitHub, create a new repo.
- Copy the repo’s URL, https://github.com/AGithubUser/my-repository-name.git.
- Open a terminal and move into the directory of the local repo.
- Execute
git remote add origin https://github.com/AGithubUser/my-repository-name.git
- You can then push to the remote by
git push -u origin master
Questions to come…
- What is a remote?
- What is origin?
- What is HEAD?
- What is a merge conflict?
- What is a branch?