Skip to content

Instantly share code, notes, and snippets.

@Tinitto
Last active March 26, 2018 10:33
Show Gist options
  • Save Tinitto/30c785c17d553d52d62432203423e15c to your computer and use it in GitHub Desktop.
Save Tinitto/30c785c17d553d52d62432203423e15c to your computer and use it in GitHub Desktop.
Creating a Remote Repo
  1. Create a new folder say new_folder. Use the command line command.
mkdir new_folder
  1. Transfer all the folders and files you want to keep in remote repository into new folder

for linux

cp path/to/file/or/folder/to/copy path/to/new_folder

for windows

copy path/to/file/or/folder/to/copy path/to/new_folder
  1. Install git if it is not yet installed. Download git for Windows here. It usually comes pre-installed on ubuntu.

  2. Enter into the newfolder

cd path/to/new_folder
  1. Initialize a git repository in that folder
git init
  1. Add all the folders and files in that folder to the newly created repository using the commands below
git add .
git commit -m "Added folders and files to repo"

Note: It might will require you to set your user.name and user.email for git. Don't worry git will guide you. Just read the error messages

  1. Create a new repo in your Github, Gitlab or Bitbucket or whatever repository service you use.

  2. Get the link to that new repository. It is usually on the front page of that repo. It is usually of the form https://<repo_service_domain>/<username>/<repository_name>.git

  3. Go to your Command line or terminal and within the new_folder run these commands.

git remote add origin https://<repo_service_domain>/<username>/<repository_name>.git
git pull origin master
git push origin master
  1. Tadaah. You are done.

A few useful links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment