simple example,
1)made a new project
rails new test_app
2) git commands
git init
git add .
git commit -m "init"
git push origin master
ok finished!
now after this, if i look at github.com webpage gui.
it doesn't show my repository.
How can i set this to my github webpage?
First of all you need to create an repository on github. After that you need to create an ssh key with github for your pc. Befor you can push to the master branch you need to add the remote repository:
git remote add origin git#github.com:yourrepo.git
Than push "origin" to the master branch.
Related
Well I'm working on rails project. Well I want o upload updated version of whole application on github branch name "dev_Bee". So can you tell me the step wise procedure how to upload my application on a specific branch. Well I'm working on ubuntu so please try to give commands for ubuntu.
Since you are using rails I'll assume your project has already git initiated.
First, you need to stage all the changes and commit
git add .
git commit -m 'Your Commit Message Here'
Then checkout to a new branch of your desired name
git checkout -b dev_Bee
Set your remote repository
git remote set-url origin https://github.com/<gitusernamehere>/<git-repo-name-here>.git
And finally push the changes to remote
git push -u origin dev_Bee
I have a github repository called A. It's connected to heroku-A and the website is up and running. I did changes locally to the code, but I don't want those changes to show on repository A or heroku-A. I want to push the code to a totally new repo. How can I do this?
Here would be the procedure:
Create a new git branch (so that code is separate from your other repo)
git checkout -b <new_branch>
Add a remote pointing to your new repository
git remote add <new_repository_url> <new_repository_name>
Push the new branch to the new repository:
git push <new_repository_name> <new_branch>
Here is what I did:
Created a Ruby on Rails app.
Initialized empty git rep
Made changes to my app and saved them (git add -A and git commit -m "blahblah")
Deployed to Heroku.
But when I visit git hub it shows zero repos?
What did I do wrong?
I think you confound github and heroku.
It's two differents repository.
Deploying to heroku with something like this:
git push heroku master
does not affect your github account.
You can have several repository for the same project.
To add a repository:
git remote add NAME_OF_YOUR_REPO URL_OF_YOUR_REPO
(you can create a project in github, and they will git you a URL_OF_YOUR_REPO)
example:
git remote add origin https://github.com/user/repo.git
after you can do:
git push origin master
and you will see your commits on github.
I'm trying to update the 3-2-stable branch on my fork of the Ruby on Rails project. So after cloning rails, I initially did a git checkout -b my_branch remotes/origin/3-2-stable. Then I made my changes. Then I added my fork as a remote repository with git remote add my_fork git#github.com:myusername/rails.git. Does a git push my_fork my_branch update the 3-2-stable branch only in my_fork? Is there something special I need to do?
Does a git push my_fork my_branch update the 3-2-stable branch only in my_fork?
Yes it will. It won't affect any other repo.
Note that the 3-2-stable on your fork won't be impacted either: a new branch my_branch will be created on your fork to reflect your local branch.
But if you want to push/pull that branch from the repo my_fork, then this would make it easier:
git push -u my_fork my_branch
See "What exactly does the “u” do? “git push -u origin master” vs “git push origin master”" for more on setting the upstream branch of a local branch.
I make some changes in local files, how can I deploy the new version?
if I type git push heroku master, it's say everything up to date, but the application wasn't changed.
You probably need to commit your changes first.
Run git commit -a -m "updated some files"
then run git push....
So you’re on a git repo with a remote repo named heroku?
Did you commit your changes, and afterwards push?
They have to be commited locally so you can push them.
When you clone a repository with git the remote repository you cloned from will be added as “origin”, then a simple git push will push to the origin.
If that’s not the case, you can use the name of another/your remote repository you added first, or it’s URL.
Also see the doc for git push: http://www.kernel.org/pub/software/scm/git/docs/git-push.html