How to Upload an Existing Project to Github
In this tutorial, nosotros volition learn how to upload your flutter project to Github. This volition be step past pace guide aimed at beginner but it can exist used by anyone. I volition be explaining by uploading Flutter project but you tin use this method to upload any project or directory.
I will exist using the InstaJoke project that I have created in the post titled Learn HTTP Request in Flutter with API call to be uploaded.
We will exist using the Git version control system and the GitHub to store our code. If yous follow opensource customs or have searched for whatsoever opensource application and so yous have come across GitHub. It is one of the code-heaven for developers. You tin can upload your projects to the platform to share it with the world and information technology also is a dandy way to showcase your skill. To upload the lawmaking we will be using Git which is besides an opensource tool for version control.
Allow united states of america go Started!!!
Getting Started
To get started and upload your palpitate projection to GitHub we volition need some software to be installed in your PC. If you already accept done this you tin can skip to next department.
You will need to have post-obit gear up:
- Git (Y'all can get the software from https://git-scm.com/)
- GitHub Account (Yous can create an account for free at https://github.com/ )
- Flutter Project or any directory
In this tutorial, I will be explaining just way to upload the flutter project or any directory to GitHub. Installing Git, creating GitHub business relationship and configuring Git is out of the scope of this tutorial. If you would like to know, please let me know in the comments, I will surely make a tutorial.
Preparing Flutter Project Directory
Now let u.s. prepare our local project directory get-go. For this purpose open your last or CMD for windows and go to your projection directory.
cd /path-to-project/InstaJoke/
Once you are inside the projection directory, we will create empty git repository or reinitialize existing one.
git init
Once the repository is initialized we will at present add together all the files in the current folder.
git add .
Discover the (dot) after add command? That will add everything from current directory, all files and sub folders.
At this moment I will like to mention most .gitignore file. This file will be car-generated when you create the Flutter project. If you check the content of this file, information technology volition accept many files and path to the directory.
What exactly does .gitignore file practice?
Any file or folder listed in the .gitignore file will not be added to our GitHub repository. Meaning it volition be ignored. This is very important if you are sharing your source code to the public. For case, you might have a new file with some credentials. You practice non desire to upload this file to GitHub, just add together the file to .gitignore file and information technology will not exist added.
OK, nosotros accept now added the file, next we will commit. While committing the changes, we will specify bulletin. So with this bulletin we can empathise what we had washed with this particular commit.
git commit -m "This is Showtime Commit"
As this will be our showtime commit, so with the message I can understand it. For this, information technology might take some fourth dimension if you accept a huge number of files.
Before we use the terminal further, allow us create repository on GitHub commencement.
Creating a GitHub Repository
To create a new repository on GitHub, you demand to visit https://github.com/ and log in to your business relationship.
Next click on the Plus (+) symbol on top right corner of the folio and click "New Repository".
Now on the new page enter the details.
- We will name this repository as "InstaJoke". Note: This name tin be different from the project proper noun on your PC.
- Entering Description is optional
- If you do not desire the public to view your project, select Private. Else go on information technology as public.
If you are proficient with details entered, click "Create repository" push.
Once the new repository is successfully created, y'all will meet a new page. If you become through this new page, you will see instructions of how to add codes to the repository.
Proceed note of the git URL. It should look something similar https://github.com/Goplax/InstaJoke.git
Now we are done with creating a repository on GitHub. Next, we will go along to add our code to this repository from our local folder.
Uploading the Flutter Projection
Now let us come back to our terminal. Nosotros will now connect our local repository with the remote repository.
git remote add origin <https://github.com/Goplax/InstaJoke.git>
In one case the above control runs successfully. Nosotros will at present upload all our files.
git push -u origin chief
Here we volition be pushing all our files to the branch "master". If you are having different co-operative, delight mention the name of that branch. This might accept some fourth dimension based on your file size and internet bandwidth.
You lot volition run across summary of this upload. It will be something similar below:
Enumerating objects: 91, washed. Counting objects: 100% (91/91), done. Delta compression using upwards to iv threads Compressing objects: 100% (72/72), done. Writing objects: 100% (91/91), 53.41 KiB | 2.32 MiB/southward, done. Total 91 (delta iii), reused 0 (delta 0) remote: Resolving deltas: 100% (3/iii), done. To <https://github.com/Goplax/InstaJoke.git> * [new branch] master -> master Branch 'master' set up to track remote branch 'primary' from 'origin'.
Now you are washed.
To check if all went skillful, open up the link to your code in GitHub website and yous should exist able to run into the files there. For this project following is the link:
https://github.com/Goplax/InstaJoke
Updating the file and uploading changes to GitHub
In the above footstep, we have seen how to create, initialize and upload your codes to GitHub using Git. Most of the time, that is not the terminate of it. You will demand to make changes in your project and upload the updated file to the GitHub repository.
In this department we will see how to do that. Kickoff make some changes to the file start. For me I am updating my README.doctor file.
Once you have made all the changes. Blazon beneath control:
git status
This command will prove the files modified past you. It volition be something like below:
On branch master Your branch is up to date with 'origin/chief'. Changes not staged for commit: (use "git add <file>..." to update what volition be committed) (use "git restore <file>..." to discard changes in working directory) modified: README.md no changes added to commit (apply "git add" and/or "git commit -a")
Next we demand to add together these changes.
git add .
This volition add all the files that you have changed. Side by side we will commit this change.
git commit -thou "Readme file update with a link to the tutorial"
You will see the summary of this commit equally shown below:
[principal f35da44] Readme file update with a link to the tutorial 1 file changed, 7 insertions(+), 16 deletions(-) rewrite README.doctor (97%)
Nosotros accept committed our changes. Now we will get-go pull the data and and then push the changes. We are pulling start to make sure that our repository is up to appointment. This is handy if you are making changes subsequently a long time and non sure if your repository is upwards to engagement or besides when you are working in a team.
git pull
git push
In one case upload is done, the summary of the upload will be displayed to y'all.
Now you tin visit your GitHub repository page and check, the new update should be there.
Conclusion
I hope yous take followed this step by step tutorial to upload your palpitate project in GitHub till the end. With that, you have learned everything from basic and is now confident. If yous had faced some issue and came to observe tips on the particular portion, well I am glad that I could help you.
Had you faced any difficulties on whatsoever part of the tutorial, mention in the comment section. I would be glad to help you through.
Source: https://instacodeblog.com/uploading-your-flutter-project-to-github/
0 Response to "How to Upload an Existing Project to Github"
Post a Comment