1

I am pretty new to programing/git and am trying to learn best practice. If I have a repo I created on my computer, what is the best way to make that a repo on github.

I have been creating on github for the most part and would like to know what the practice would be if I wanted/needed to do it in reverse.

Thanks.

2 Answers 2

2

You need to create repository on GitHub first. To avoid confusion create it with the same name you already have to your repository.

Change the current working directory

cd project_folder 

Assuming you have initialized your repository and committed some files using:

git init git add . git commit -m "First commit" 

Copy the newly created repository URL and add remote using this command:

git remote add origin remote_repository_URL 

push to remote repository

git push origin master # master here is your branch 

Follow this link for detailed steps

Sign up to request clarification or add additional context in comments.

Comments

1

Remember that before pushing your repository to GitHub you need to commit your changes:

git commit -m "My last changes" 

Then you need to create empty project on GitHub without readme nor gitignore file.

To send your code to github you shall add remote(which is your empty github project) to your local repository:

git remote add origin <github project url> 

At last you should push your state of repository to remote:

git push origin master 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.