Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to push local code to git repository

--::-- Using SSH --::--
#### Create SSH key ####
$ ssh-keygen -t ed25519 -C "<YourEmail>@<Domain>.com"

#### Copy the SSH key ####
$ cat /path/to/private_key_file.pub

#### Add the SSH key to your GitHub account ####

$ echo "# myPracticeRepo" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main
$ git config core.sshCommand 'ssh -i /path/to/private_key_file'
$ git remote add origin git@github.com:<UserName>/<RepoName>.git
$ git push -u origin main


--::-- Using HTML --::--
$ echo "# myPracticeRepo" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main
$ git remote add origin https://github.com/<UserName>/<RepoName>.git
$ git push -u origin main
Source by docs.gitlab.com #
 
PREVIOUS NEXT
Tagged: #push #local #code #git #repository
ADD COMMENT
Topic
Name
7+8 =