With Git you don't create a repository directly on a server. Instead, you
- create a repository locally (
git init
),
- add files to it, which generally comprises two steps:
- stage files (
git add
)
- commit the staged files into the local repository (
git commit
)
- assign a remote server's repository to it (
git remote add
)
- Note 1: I assume you have created a remote repository somehow - please refer to your server instructions.
- Note 2: You create an empty repository on the server.
- upload your local repository to the remote one (
git push
)
Sample script:
$ cd your_local_project_dir/ # Get into your your project directory
$ git init # Initialize a local repository
$ git add --all # Stage all files from your local project
# directory for commit (note this is not
# adding to the repository yet, it's just
# "prepare them to add into the repo")
$ git commit -m "Initial commit" # Add the staged files to the local repository
$ git remote add origin https://server.com/user/project_name.git
# Link the local repository to a remote one
$ git push -u origin master # Upload you local repository data to the
# remote one