- Create a new folder say
new_folder
. Use the command line command.
mkdir new_folder
- 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
-
Install git if it is not yet installed. Download git for Windows here. It usually comes pre-installed on ubuntu.
-
Enter into the newfolder
cd path/to/new_folder
- Initialize a git repository in that folder
git init
- 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
-
Create a new repo in your Github, Gitlab or Bitbucket or whatever repository service you use.
-
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
-
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
- Tadaah. You are done.
A few useful links