Error Deploying Artifact to Github from VSTS - azure-devops

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:

Related

How to commit code to GitHub on Android through termux app

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 can't push to branch "dev" in Github using CircleCi

I am trying to configure autopush to the branch dev in github, using CircleCi. The problem is that I get an error like:
"error: src refspec dev does not match any.
error: failed to push some refs to 'git#github.com:myname/repo.git'.
Exited with code 1".
When I am using git remote -v, I can see:
origin git#github.com:myname/repo.git (fetch)
origin git#github.com:myname/repo.git (push)
And on the github required branch "dev" exists. Below you can see the part of my *yml code for CircleCi that makes everything.
- run:
name: Git config email
command: git config --global user.email "name#mail.ru"
- run:
name: Git config name
command: git config --global user.name "Name"
- run:
name: git remote -v
command: git remote -v
- run:
name: Push to dev
command: git push origin dev --force
git checkout dev and refs/heads/dev appeared, but the command git push origin dev do not pushed changes into git branch "dev".
That would create a local dev branch based by default on origin/dev.
You would need to merge my_branch to dev first before pushing
git merge my_branch
git push
(git push should be enough, since the newly local created branch dev has origin/dev for its upstream branch)

How to update code in gitlab

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

Github - How to update my own repository?

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

How to push on my development branch on Github

I get an issue when I try to push on my development branch on Github. Actually, I forked the microscopejs repository to update some files...
Command :
git clone https://github.com/tonymx227/microscopejs.git
git add remote upstream https://github.com/tonymx227/microscopejs.git
git fetch upstream
// I updated some files using Sublime Text 2 here
git add . -A
git commit -m 'test'
git push origin development
Issue :
error: src refspec development does not match any.
error: failed to push some refs to 'https://github.com/tonymx227/microscopejs.git'
You haven't create a local development branch.
You only have the remote tracking branch origin/development after your clone.
Do first a:
git checkout -b development origin/development
Then:
git add . -A
git commit -m 'test'
git push -u origin development
Note: you don't need the git remote add upstream step.