Comments (3)
It looks like the problem here is that the pass
variable passed in is None
and you're calling .unwrap()
. I believe this is just the password encoded in the URL, and it will be None
if there wasn't one. If you use .unwrap_or(...)
with a default password (or one learned from elsewhere), I think that'd do the trick!
from git2-rs.
Sorry for the delay.
I've update my code, and the program seems to loop...
This is my code:
match branch_back_up.as_mut() {
Ok(branch) => match branch.set_upstream(Some("back_up")) {
Ok(_) => println!("Branch 'back_up' has been updated!"),
Err(error) => println!("Error due to {}", error),
},
Err(error) => panic!("Canno't upstream the branch 'back_up', due to error {}", error),
}
let refname = match branch_back_up.as_mut() {
Ok(branch) => branch.get(),
Err(error) => panic!("ERROR: {}", error),
};
// Find remote
let mut r_remote = r.find_remote("origin").unwrap();
// Push branch
let mut callbacks = RemoteCallbacks::new();
callbacks.credentials(|user, pass, ctype| {
return Cred::userpass_plaintext(user, pass.unwrap_or("MY_PASSWORD"));
});
let mut push_options = PushOptions::new();
push_options.remote_callbacks(callbacks);
match r_remote.push(&[], Some(&mut push_options)) {
Ok(_) => println!("Branch has been pushed!"),
Err(error) => println!("Error {}", error),
};
but, since less 10 minutes, the program is blocked on
README.md has been added!
Branch 'back_up' has been updated!
Did I missed something? :-/
from git2-rs.
I think that you may have to specify some refs of what to push? I always forget what you precisely need to pass in, but it may help to see a working code example as well, although that doesn't deal with branches much as it only works with the master
branch
from git2-rs.
Related Issues (20)
- Find files added between two commits
- Issue linking with arm64 and musl (Alpine 3.18) HOT 1
- how can i see changes in merge request?
- Git2-rs on Android got error "the SSL certificate is invalid" HOT 1
- How to resolve `HEAD` on an empty repository? HOT 1
- License compatibility with libgit2 ? HOT 2
- Applying diff with renamed file to Index ignores delta callback and removes old file from index HOT 4
- Blobless / Treeless (partial) clones HOT 3
- `libgit2-sys` fails to build with vendored openssl because of misconfigured `cc` parallelism HOT 4
- support building USE_SSH=exec HOT 1
- self sign certificate
- Tree.walk() broken for subtrees with non-utf-8 names HOT 1
- using russh
- Signing a tag HOT 1
- Unclear documatation: branch_remote_name
- Build problems with installed libgit2 1.8.0 HOT 3
- The error caused by failed `push_negotiation` is strange: `"config value 'pack.windowMemory' was not found"` HOT 4
- git clone arguments HOT 1
- Segmentation fault when cloning invalid URL HOT 1
- rustls support? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git2-rs.