Skip to main content

Command Palette

Search for a command to run...

Creating a GitHub repository and uploading files for first time

Updated
2 min read
Creating a GitHub repository and uploading files for first time
C

Hi, I'm Cristina Ramirez, I'm a computer engineer and software developer with more than 10 years of experience as backend developer, web application development, API REST services for mobile applications, system analysis and logic.

Programming languages: Ruby, PHP, C, C++, C#, CSS, JavaScript.

Frameworks: Ruby on Rails, PHP (Codeigniter, APPHP).

Experience of relational databases (Postgres, MySql, Oracle) and NoSQL databases (MongoDB, Neo4j).

I like innovation and teamwork.

🇻🇪 Spanish

1.- Create a new folder for a new project.

mkdir ruby
cd ruby

2.- Create a local repository with git init command.

git init

3.- Rename the master branch to main.

git config --global init.defaultBranch main

Or open HEAD file and change master branch by main.

4.- Create a repository on GitHub to put your new project.

5.- Put files in the new folder. This is Working directory area.

6.- Copy SSH name of the new remote repository: git@github.com:delgadocris/ruby.git

7.- Show local repository status with git status command. This shows the status of changes as untracked, modified, or staged.

git status

8.- The easiest way to add all files to staging area is using git add . command. The files will be uploaded to the remote repository using other commands (commit and push). If you want to exclude files from staging area you can use unstage.

git add .

9.- Run git commit -m "<message>" command. This command moves files from staging area to .git directory. This command saves the snapshot to the project history and completes the change-tracking process. In "message" you must write a description of the changes.

git commit -m "<message>"

10.- Run git remote add origin <name_repository_ssh> command. This command provides the path for the repository you created on GitHub.

git remote add origin git@github.com:delgadocris/ruby.git

11.- Run git pull origin main to download the latest changes from the remote repository to the local repository. Developers use this command if a teammate has made commits to a branch on a remote, and they would like to reflect those changes in their local environment.

git pull origin main

12.- Run git push <name_repository_ssh> command to update the remote repository with any commits made locally to a branch. This command uploads content from the local repository to the remote repository.

git push git@github.com:delgadocris/ruby.git

Note: Regarding git push command, I recommend reading the guide for Creating a personal access token to Git operations.

13.- You can use smartGit to see your repository.

References:

https://git-scm.com/book/es/v2

74 views