How can I import source code from my computer to my GitHub account?
Join them; it only takes a minute:
|
|
If you've got local source code you want to add to a new remote new git repository without 'cloning' the remote first, do the following (I often do this - you create your remote empty repository in bitbucket/github, then push up your source)
|
|||||||||||||||||||||
|
|
This is explained in the excellent free eBook ProGit. It assumes you already have a local Git repository and a remote one. To connect them use:
To push the data from the local repository to GitHub use:
If you have not setup a local and/or a remote repository yet, check out the help on GitHub and the previous chapters in the book. |
|||||
|
|
One of the comments mentioned using the GitHub GUI, but it didn't give any specific help on using and notice that most if not all the answers were useful at the command prompt only. If you want to use the GitHub GUI, you can follow these steps:
After a moment with a spinning GitHub icon, your source code will belong to a local repository and pushed/synchronised with a remote repository on your GitHub account. All of this is presuming you've previously set up the GitHub GUI, your GitHub account, and SSH keys. |
|||||||||||||
|
|
As JB quite rightly points out, it's made incredibly easy on GitHub by simply following the instructions. Here's an example of the instructions displayed after setting up a new repository on GitHub using http://github.com/new when you're logged in.
It couldn't be easier!! |
||||
|
|
|
Yes. Create a new repository, doing a More here: http://help.github.com/creating-a-repo/ |
|||
|
|
|
||||
|
|
|
I had a bit of trouble with merging when trying to do Pete's steps. These are the steps I ended up with.
|
|||||
|
|
From Bitbucket: Push up an existing repository. You already have a Git repository on your computer. Let's push it up to Bitbucket:
|
|||||
|
|
I came here looking for a simple way to add existing source files to a GitHub repository. I saw @Pete's excellently complete answer and thought "What?! There must be a simpler way." Here's that simpler way in five steps (no console action required!) If you're really in a hurry, you can just read step 3. The others are only there for completeness.
Done! |
|||
|
|
|
Add a GitHub repository as remote origin (replace [] with your URL):
Switch to your master branch and copy it to develop branch:
Push your develop branch to the GitHub develop branch (
|
||||
|
|
|
Here are some instructions on how to initiate a GitHub repository and then push code you've already created to it. The first set of instructions are directly from GitHub. Source: https://help.github.com/articles/create-a-repo/
Congratulations! You've successfully created your first repository, and initialized it with a README file. Now after these steps you will want to push the code on your local computer up to the repository you just created and you do this following these steps:
That's it. Your code will now be pushed up to GitHub. Now every time you want to keep pushing code that has changed just do.
|
||||
|
|
|
Actually, if you opt for creating an empty repo on GitHub it gives you exact instructions that you can almost copy and paste into your terminal which are (at this point in time):
|
||||
|
|
|
Solution for me: The problem is the size of a file, which cannot exceed 100M. Before migrating to github, in the repository do this:
Ready! Now make the migration again by the tool: https://github.com/new/import see more: Error while pushing to github repo and https://rtyley.github.io/bfg-repo-cleaner/ I hope I helped you. :) |
|||
|
|



