banner



How To Upload Code To Github And Share

How to Push to GitHub

Pushing code to GitHub means to upload your project code to the GitHub.com code-hosting service. In this short commodity, we'll show you how to do this using Git on the Command Line as well as through a desktop GUI.

The Git Cheat Sail

No demand to remember all those commands and parameters: go our pop "Git Crook Sheet" - for free!

How to Create a Local Repository

First, y'all need to have a local repository for your bodily project code. (If yous already have this, skip to the next section beneath titled "How to Push to GitHub".)

Using Git on the Command Line

Open the command line ("Terminal" on the Mac, "Git Bash" on Windows) and modify into your project'due south base directory. At that place, you can create a new Git repository:

          $ cd projects/my-project $ git init        

As a first step, you can add together all of your current files to the repository and and then parcel these in a commit:

          $ git add . $ git commit -m "Initial commit"        

Using Git in a Desktop GUI

In instance you're using a desktop GUI similar the Belfry Git client, the process is very easy: you tin can only drag your project's base of operations binder into Tower and have information technology create the Git repository for y'all.

You can then add all files to the Staging Area and make your start commit:

Now, y'all are set to push your lawmaking to GitHub!

How to Push button to GitHub

Earlier you lot can upload your code to GitHub, you need to create a remote repository in your GitHub account.

Using Git on the Command Line

If you're working with Git on the Control Line, you'll have to open the GitHub.com interface in your browser. Right on the "Dashboard" view, you tin see a button to create a new repository:

Then, on the project's master page, you can use the green "Code" button to reveal the repository's remote URL and re-create information technology to your clipboard:

You can then connect this remote repository to your local Git repository with the following command:

          $ git remote add origin <remote repository URL>        

The final pace is to push button your changes from your local repository to your new remote repository:

          $ git push origin master        

Using Git in a Desktop GUI

In example you're using a desktop GUI similar the Tower Git client, you tin can only follow these elementary steps:

  1. right-click the "Remotes" section header in the sidebar and select "Add Remote Repository"
  2. in the dialog, you tin enter a name (e.g. "origin") and the remote repo's URL on Github; additionally, y'all can select your GitHub business relationship
  3. confirm the dialog and the remote volition now be connected with your local repository
  4. from now on, you can simply use the "Push" push in the toolbar to upload new changes to the remote on GitHub

Acquire More

  • Check out the chapter Starting with an Unversioned Projection in our gratuitous online book
  • More than oftentimes asked questions most Git & version control

Source: https://www.git-tower.com/learn/git/faq/push-to-github/

Posted by: taylorvisiong.blogspot.com

0 Response to "How To Upload Code To Github And Share"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel