My team committed code to gitlab repository and I need to take those updates. I already clone the project into my local directory but didn't take update before.
For taking update what commands need to run. I already tried pull command and it shows the changed file details but that changes are not applying to the project. For apply the changes any new command needs to run again?
Run following commands for taking the update:
git fetch && git checkout master
git pull
git config --global user.name "demo"
git config --global user.email "demo#gmail.com"
Create a new repository:
git clone https://gitlab.com/demo_test.git
cd demo_test
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main
Push an existing folder:
cd existing_folder
git init --initial-branch=main
git remote add origin https://gitlab.com/demo_test.git
git add .
git commit -m "Initial commit"
git push -u origin main
Push an existing Git repository:
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/demo_test.git
git push -u origin --all
git push -u origin --tags
Related
When I use create-react-app and cd into the directory it already shows me (master) when I haven't even initialized git. When I try to do git init and set remote origin it still stays the same and my repository isn't connected. What should I do?
Create react app initialises git automatically, and adds a .gitignore
Try to solve it by this example
echo "# qqq" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git#github.com:{username}/{repository}.git
git push -u origin main
Please I would appreciate if anyone can drop a direct link to the termux commands used to create repos,commit code and delete them on GitHub through termux terminal,all I have seen through numerous Google searches are only how to install them,I also don't know how to navigate to a certain file or directory.
First of all you have to install git in termux pkg install git . then go to the directory where your code have with cd <name of your directory>
If you want to create a git repository use git init.
then add the files to git
git add <file name> OR add all files in the directory git add .
First commit after installing git you have to specify who you are
git config --global user.name "<Your Name>"
git config --global user.email "<your_email#whatever.com>"
then commit the code with
git commit -m "<commit message>"
commit message is what changes you done in this commit
you have to create a reposityory in github github.com/new
and add github reposityory url to git git remote add origin https://github.com/<github username>/<github repository name>.git
then push the repository to github. git push -u origin master
-u means seting upstream as default. after that just git push
have some reference of tutorials about git
learnxinyminutes, githowto
I am trying to build maven project in VSTS using hosted agent.
I want to deploy my artifact to github. task i am using is Powershell. i am getting error "There is no tracking information for the current branch".
but artifcat are deploying to github, But Build Defination is failing.
If the github repo is not empty and you want to keep the commit histories, you can use the script as below:
cd $(Build.ArtifactStagingDirectory)
git init
git config --global user.name name
git config --global user.email ***#gmail.com
git add .
git commit -m "update"
git remote add origin https://username:password#github.com/username/reponame -f
git checkout -b temp
git checkout master
git reset --hard origin/master
git merge temp -X theirs --allow-unrelated-histories
git push -u origin master
If the github repo is empty or you don’t need to keep the commit histories, you can use the script as below:
cd $(Build.ArtifactStagingDirectory)
git init
git config --global user.name name
git config --global user.email ***#gmail.com
git add .
git commit -m "update"
git remote add origin https://username:password#github.com/username/reponame -f
git push -f origin master
And deselect Fail on Standard Error option:
I have cloned certain github repositories to my laptop. Now I want to push these local directories to my github .When I do "git push origin master" everything does smoothly. But if I have a look at my github repository I can only see empty directories getting created. All the directories are under the same directory .
The commands that I perform to update on github :
git add .
git commit -m ""
git push origin master
Following is a snapshot of my github view :
i think you havent added new files to repository
1. git status
2. git add -A
3. git commit -am "your commit"
4. git push origin master
try these i believe this will help yo
I did the following and it worked :
git rm --cached Retrofit2SampleApp
git rm --cached ud851-Sunshine
rm -rf Retrofit2SampleApp/.git
rm -rf ud851-Sunshine/.git
git add Retrofit2SampleApp
git add ud851-Sunshine
git commit -m "commit after removing cache and .git inside the folders"
git push origin master
Got some clue from the following link :
Git - how to track untracked content?
I have a repository in my Github, and I cloned it on my desktop. Then I did some work in the folder. How do I commit those changes to my repository?
below code is right, but don't forget to add remote address to key "origin".
git remote add origin <YOUR_REPOSITORY_PATH>
git add .
git commit -m 'some change'
git push -u origin master
-u – sets repo branch as defaults, so then you can push, just git push
May
git add .
git commit -m "my changes"
git push origin master