Once that is checked, you can click push and Fork will push your project onto Github. For now, just remember you need to create a tracking reference. ![]() We’ll talk about branching in a later lesson. Note: if branching sounds foreign to you right now, don’t worry about it. If you don’t create a tracking reference, you will need to specify which branch to push to (or pull from) every time. When you push your files onto the remote for the first time, make sure the create tracking reference checkbox is checked.Ī tracking reference tells Git to track the current branch (master in this case) and to push or pull to the same branch on the remote. The repository URL should be the URL you copied from Github. If you have multiple remotes, you will want to rename the remote according to where they are from (like Github, Heroku, and Bitbucket). The default name for most remotes will be origin. To add the remote, click on the select box and select add remote. We need to add the remote we just created. In this case, our branch will be master (because we only have one branch). Once you click on the push button, Fork will ask you to select a branch and a remote to push to. It looks like an arrow that goes upwards. Next, open the project in Fork and click the Push button. SSH lets you push (put things into the remote repository) and pull (copy the remote back to your local) without entering your Github username and password every time. Linking the local repository to the remote repository You’re going to learn how to do them in a few lessons.įor now, we want to link up our local repository in Fork to the remote repository we just created. This knowledge requires you to use the Git command line. Once you click on create repository, you’ll come to a page with some Git instructions. Then, ignore the rest and click on the create repository button. Set the project to public or private, depending on what you want. The description is for you to describe your project in a line so other people can understand what your project is about. To create a new repository, you need to give your repository a name. Click on this plus button and select new repository. Once you sign in, you’ll see a plus (+) button on the right-hand corner of the page. Create an account if you don’t have one already. The other services follow the same instructions. This article shows you how to set up a remote on Github. If you want to create a private repository on Github, you need to pay $7 a month. If you want to create private repositories, you might want to consider Bitbucket or Gitlab because they let you create private repositories for free. A private repository is a Git repository that can only be read by you and people you give permission to. Sometimes you may want to create private repositories. (Note: open source projects can also be hosted on Bitbucket and Gitlab as well). This is also why most open source projects are hosted on Github. Many people like to use Github because Github is the most popular one out of the three. The only differences between the services are their popularity, their web interface, and their pricing. There are no differences between these three services when Git itself is concerned. If your computer crashes, you can always get the latest version from the remote back onto your computer.īefore we talk about Git remotes, we have to talk about different services that provide you with Git remotes. ![]() ![]() In Git terminology, we call the Git repository on your computer a local repository.Ī Git remote is the same repository stored somewhere else on the internet. It is common to use upstream as the nickname for this remote.Note: This the third video in the Git for beginners series. It makes your setup easier for others to understand and for you to transfer information that you read in documentation, on Stack Overflow, or in blogs.Ī common reason to add a second remote is when you have done a “fork and clone” of a repo and your personal copy (your fork) is set up as the origin remote.Įventually you will want to pull changes from the original repository. It is tempting to use a more descriptive nickname (such as github), but you might find that following convention is worth it. Sidebar on nicknames: there is a strong convention to use origin as the nickname of your main remote.Īt this point, it is common for the main remote of a repo to be hosted on GitHub (or GitLab or Bitbucket). Note: when you add a remote you give it a nickname (here happygit), which you can use in git commands in place of the entire URL. Use git remote add to add a new remote: git remote add happygit ![]() However, after the initial clone, it is often useful to add additional remotes. Git clone automatically adds a new remote, so often you do not need to do
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |