Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload local repository to github.com

Tags:

git

github

I have a git repository which exists fully locally inside my PC. I want to create remote clone of it onto the github.com. How can it be done?

like image 207
Alex Chudinov Avatar asked Aug 24 '18 03:08

Alex Chudinov


4 Answers

It looks very basic question still follow the below steps

Step 1 : You need to create git hub repository first

Step 2 : Then copy the URL of git hub repo

Step 4 : Then add remote for the git hub repo (git remote add origin "copied repo URL")

Step 3 : Then clone the repo (Redme files will cloned ) (git clone "copied repo URL")

Step 5 : Then add file (git add * or git add . or git add file name)

Step 6 : git commit -m "your message"

Step 7 : The push it (git push origin "branch name")

Login to git-hub and check you Repository

like image 69
sachin_ur Avatar answered Nov 19 '22 21:11

sachin_ur


Add a new repository in GitHub and then in the folder on your computer that you want to upload to GitHub run the following commands (changing my_username and my_project to your situation):

git init
git add .
git commit -m "initial commit"
git remote add origin https://github.com/my_username/my_project.git
git push --set-upstream origin master

Notes

If this is your very first time setting up git on your local machine, then you need to add your username and email:

git config --global user.name "Bob"
git config --global user.email [email protected]

In the future when you make changes you can simply do the following:

git add .
git commit -m "description of what I changed"
git push

I also use git status a lot to see what has changed or is ready to commit.

like image 36
Suragch Avatar answered Nov 19 '22 21:11

Suragch


  1. You first need to create a GitHub repo "without a README.md" file.

  2. On the next page,GitHub itself displays you the commands you need to run to push/upload your local repo.

  3. Go to your local repo through the terminal, paste those commands and you'll be good to go.

like image 4
Prakhar de Anand Avatar answered Nov 19 '22 22:11

Prakhar de Anand


my way to upload existing local repository

  1. Make new repo(give a name but don't click any combo box to initialize).
  2. Open git bash in the local repo.
  3. add : `
  • git remote add origin https://github.com/..../(reponame).git
  • git branch -M main
  • git push -u origin main

name "origin" and "main" up to you. make sure you are logged in on local git bash

like image 3
arnauth akb Avatar answered Nov 19 '22 21:11

arnauth akb