0 votes
1 view
in Devops and Agile by (28.1k points)
edited by

How can I import source code from my computer to my GitHub account?

1 Answer

0 votes
by (48k points)

If you want to add local code to a new remote git repository without 'cloning' the old remote, do the following

Create the remote repository and get its url like:

[email protected]:/youruser/somename.git or https://github.com/youruser/somename.git

Locally, at the root directory of your source,

git init

(If you initialize the repo with a .gitignore and a README.md you should do a git pull {url} to ensure you don't commit files to source that you want to ignore). 

Add and commit what you want in your initial repo.

To attach your remote repo with the name 'origin' 

git remote add origin [URL ]

Execute git pull origin master to pull the remote branch so that they are in sync.

To push up your master branch:

git push origin master

Thus, you can import existing code to github.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...