Reputation: 21329
I have installed Git for Windows. There is both a graphical shell and a shell with CUI. I have created a repository using the graphical shell :
How do I push the code to the Git repository ? In the repository URL, I see this push URL :
git remote add origin https://github.com/suhailgupta03/Nappster.git
git push -u origin master
Can anyone please tell, how do I use this URL to push the code ? Like I have a directory named x
and I want to upload the code in that directory to the repository named Nappster
(the url for which I have give above.)
Upvotes: 1
Views: 130
Reputation: 7818
There two things you can do, you can either
a. Copy the code in directory 'x' to 'Nappster' and run the following commands from the Git CLI
cd /w/GitHub/Nappster
git add .
git remote add origin https://github.com/suhailgupta03/Nappster.git
git push -u origin master
or b. Initialise 'x' as the git repo
cd path/to/x
git init
git add .
git remote add origin https://github.com/suhailgupta03/Nappster.git
git push -u origin master
You can call your origin whatever you like, eg. github
git remote add github https://github.com/suhailgupta03/Nappster.git
git push -u github master
Every time you do a push from thereon, should drop the -u flag so it's just
git push github master
Word of warning, if you have a file that contains database connection info for example, you need to add that file name eg db_credentials.php to the .gitignore file and create another file eg. db_credentials.php.dist without the sensitive info
Upvotes: 1
Reputation: 1327912
If you are suhailgupta03
on GitHub, a simple click on the "pushing to GitHub" should be enough.
If not, that button would push to a newly create GitHub 'Napster
' repo owithin your GitHub account.
Or you can define a primary remote repo, as I illustrate in "Use GitHub for Windows
for both BitBucket and Github".
Upvotes: 1