How to Upload to Github Using Git
GitHub is a web-based hosting service for software development projects that use the Git revision control organisation. It is used to share code with other people and a GitHub business relationship is complimentary for open source projects.
Post-obit tutorial will show you how to setup and configure Git Gui on your Windows estimator then yous tin upload code towards a remote GitHub repository.
Note that we have switched to Sourcetree which is another free Git GUI alternative for Mac and Windows. Nosotros highly recommend yous check it out as it is simple to use and very powerful in terms of features.
Git GUI Install
Start, permit's outset past going to the Git downloads folio and download the Git installer for your operating organization. In this tutorial, we will use Windows.
Double click to run the downloaded '.exe' file and click Adjacent keeping the default settings on the different installer steps. At the finish click Finish and Git should exist successfully installed.
Start the Git command processor by clicking on the Git Bash link inside the Git program group Offset>All Programs>Git. A bash window should appear every bit shown beneath.
Configure Git
The get-go thing that needs to exist done is to setup some basic Git parameters like user proper name and electronic mail accost. In order to practise so enter following commands and replace the value between the quotes with your ain values.
git config --global user.name "<user_name>" git config --global user.electronic mail "<user_email>" Shown below is the execution of the two commands.
In guild to verify if the values are set correctly enter the following command:
The result is a list of configuration parameters as shown below.
Generating SSH keys
It is strongly recommended to use an SSH connection when interacting with GitHub. SSH keys are a style to identify trusted computers, without involving passwords. To generate a new SSH key pair, copy and paste the command beneath, making certain to substitute the email value betwixt the quotes with your own.
ssh-keygen -t rsa -C "<user_email>" When asked to 'Enter file in which to save the key' just printing ENTER to continue. So a passphrase is requested which acts equally a countersign you need to enter each fourth dimension you lot want to use your fundamental with SSH. Enter your countersign twice and the consequence should exist as shown beneath.
Locate the generated keys by going to the location as shown in the console output. In the above instance the location is: C:\Users\source4code\.ssh.
The id_rsa file contains your private key and the id_rsa.pub file contains your public key.
Configure GitHub
Create an account at GitHub and sign in. Add a new remote repository by clicking the + New repository push button. Enter a repository name and check the 'Initialize this repository with a README' checkbox so a README.dr. is automatically added as shown below.
Next step is to add the public SSH fundamental to your GitHub account. To practice and so admission the GitHub account settings by clicking on the wrench/screwdriver icon in the peak right-hand corner. Then on the left-hand side menu click on the SSH keys link.
Click on the Add SSH key button in the top correct paw corner. In the 'Title' text field enter a name for the public fundamental that nosotros volition add (in the example below the proper name "examination-repo" is used). So open the id_rsa.pub file that was generated in the previous department and re-create paste the contents in the 'Key' text field as shown below. Relieve the SSH key by clicking the Add key push button.
The newly added key is function of the SSH keys that are associated with your account as shown beneath.
Annotation that the cardinal fingerprint shown should be the same as the i that was printed during SSH keys creation in the previous section: 41:d7:ed:23:51:e0:air conditioning:54:b4:52:6a:cf:b4:52:02
Configure Git GUI
Start Git GUI by clicking on the Git GUI link inside the Git program group. Following window should appear.
The first thing to do is to create a new local Git repository. Click on the Create New Repository link and select a folder in which you would like to create a new local repository. In the example beneath the local repository is created at C:/source4code/code/exam-repo. Click the Create push to complete the repository creation.
A new window will open which shows the newly created Git repository.
Adjacent step is to add together the remote Git repository at GitHub. Click on the Remote menu and select Add. A new window will pop-upward in which a proper name for the remote repository and the location need to exist added. In this instance we will enter "exam-repo" as name and "[email protected]:source4code/test-repo.git" as location as shown below.
The location for the remote GitHub repository tin can be found by logging into GitHub, selecting the repository to be added and then clicking on the SSH link at the bottom right-hand side of the screen.
If the 'Fetch Immediately' activeness in the popup window was left selected, the first thing Git GUI volition practise is fetch the content of the remote GitHub repository. Enter the passphrase of the SSH keys generated in the previous section and press OK. The outcome should exist a success status as shown below. Click the Close button to stop.
Git GUI Usage
Now that the remote repository was fetched we need to merge it with the local repository. Before this tin can exist washed, a local baseline is needed to merge with. Open the local repository location, in this instance it was C:/source4code/code/exam-repo and add a file test1.txt.
Switch back to Git GUI and press the Rescan push button. The added file should now announced under the 'Unstaged Changes' department. Then click on the Phase Changed button to tag the added file to exist part of the files on which we will create a baseline and click Aye to confirm the untracked file. The file should now appear in the 'Staged Changes' section as shown beneath.
You can move files between the 'Unstaged Changes' and 'Staged Changes' section by using the Commit menu.
Add an initial commit bulletin in the corresponding text box equally shown below.
Printing the Commit button. The file will disappear from the 'Staged Changes' section and at the bottom of the screen a "Created commit" message should announced.
Now the local and remote baseline need to be merged. Click on the Merge menu and select Local Merge. A new window will popular-upwards that shows the possible baselines that tin can exist merged with the local master baseline.
If the remote 'test-repo/master' does non show equally below, make sure to restart Git GUI!
Click on the Merge push and a success status should be appear which shows that the README.doctor file from the remote repository was successfully added.
The last matter left to do is to push the merged local baseline to GitHub. In lodge to do so select the Remote menu and click on the Push button carte item. A new window is shown which shows the local master that will be pushed to the remote 'examination-repo'.
Click the Push push and enter the passphrase of the SSH keys. A success bulletin should be shown. Close the message by clicking on the Close button and open your GitHub business relationship. Select your repository and the test1.txt file should be present as shown beneath.
From at present on you tin add/change files on your local repository that can then be pushed to GitHub once committed.
This concludes our tutorial on calculation a remote repository to Git GUI so that code files tin can be uploaded to GitHub. If you found this post helpful or have any questions or remarks, please leave a comment.
Source: https://codenotfound.com/github-add-remote-git-gui-windows.html
Post a Comment for "How to Upload to Github Using Git"