top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Push code to Remote GitHub using Command Line

Using a GitHub webpage is known as "remote GitHub". To push code to remote GitHub. We must first establish a new repository on the remote GitHub.

 

There is a + sign in the right corner, click it and Select "New Repository."


 

Give the repository name. By default, the setting will be public. You can select private if you'd like to. Let's create a public repository that everyone may view for now. Then click “create repository”.



After creating the new repository, it will lead to this page. This provides the command line comments in addition to the URL link of this new repository. 



Now go to your local which is your desktop folder where you kept the code that you want to share in remote GitHub and right click on that page. Click on “Open Git Bash here”

 

 

This command line screen will open after you click it. We need to give the comments here. Enter “git init”. This will generate a local repository called ". git" in the same folder in desktop.



Now enter “git add .” to add all the files to the local repository.

Then enter "git status” to see all the files that are staged to commit.

 


Now give “git commit -m “first commit” to branch master and it will update your branch with ‘origin/master’.


 

Now enter remote repository URL link with the comment



Then enter “git push -u origin master” to push the local git files to remote GitHub repository.


*[new branch] master -> master  

Branch ‘master’ set up to track ‘origin/master’.

 

Now refresh the remote GitHub and you can be able to see all the code pushed to remote GitHub from local git.



Follow the steps listed below to convert a created public repository to private.

Go to created repository and look for settings as follow and click it.



In this page go to the bottom. There is Danger Zone. Inside that click “Change visibility”. Then select change to private.

 


Select “I want to make this repository private”



Select “I have read and understand these effects”



Select “Make this repository private”



Refresh and see you will be able to see it changed to private.


 

 

30 views0 comments

Recent Posts

See All
bottom of page